m /etc/my.cnf //编写配置文件
[root@RS1 ~]# cat /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
[root@RS1 support-files]# cp mysql.server /etc/init.d/mysqld
[root@RS1 support-files]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql //数据库存放位置
datadir=/opt/data //数据存放位置
[root@RS1 support-files]# chmod +x /etc/init.d/mysqld
//赋予执行权限
[root@RS1 support-files]# cd
[root@RS1 ~]# cp /usr/lib/systemd/system/sshd.service /usr/lib/systemd/system/mysqld.service //将其添加到systemd服务中
[root@RS1 ~]# vim /usr/lib/systemd/system/mysqld.service
[root@RS1 ~]# cat /usr/lib/systemd/system/mysqld.service
[Unit]
Description=mysqld server daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/mysql/support-files/mysql.server start
ExecStop=/usr/local/mysql/support-files/mysql.server stop
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
[root@RS1 ~]# systemctl daemon-reload //重新加载配置
[root@RS1 ~]# systemctl enable --now mysqld.service
[root@RS1 ~]# ss -antl //查看端口
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 70 *:33060 *:*
LISTEN 0 128 *:3306 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@RS1 ~]# cat password //查看密码
FBjyVRqnF6%;
[root@RS1 ~]# mysql -uroot -p'FBjyVRqnF6%;' //使用临时密码登录
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.30
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.01 sec) //修改密码
mysql> exit
Bye
[root@RS1 ~]# mysql -uroot -p'123456' //测试
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.30 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit
Bye
源码安装php
[root@RS1 ~]# wget https://www.php.net/distributions/php-8.1.11.tar.xz //下载安装包
[root@RS1 ~]# ls
anaconda-ks.cfg nginx-1.22.0 password
mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz nginx-1.22.0.tar.gz php-8.1.11.tar.xz
[root@RS1 ~]# vim /etc/hosts //可以提前做一个映射,防止访问不了github
[root@RS1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
20.205.243.166 github.com //添加
[root@RS1 ~]# yum -y install autoconf freetype gd libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel net-snmp-devel libjpeg-devel php-ldap openldap-devel openldap-clients freetype-devel gmp-devel libzip libzip-devel sqlite-devel readline-
|