近期在整理文档资料,顺便发出来好了。
卸载冲突软件:
rpm -qa | grep postfix
如果存在 postfix-2:2.10.1-6.el7.x86_64
,则卸载:
rpm -ev postfix-2.10.1-6.el7.x86_64
# 强制卸载
# rpm -e --nodeps postfix-2.10.1-6.el7.x86_64
同理,如果存在 mariadb-libs-5.5.56-2.el7.x86_64
,则卸载:
rpm -qa | grep mariadb
rpm -ev mariadb-libs-5.5.56-2.el7.x86_64
MySQL 安装:
mkdir -p /usr/local/togest/mysql
cd /usr/local/togest/mysql
将以下文件拷贝至上述目录:
- mysql-5.7.44-1.el7.x86_64.rpm-bundle.tar
- net-tools-2.0-0.22.20131004git.el7.x86_64.rpm
rpm -ivh net-tools-2.0-0.22.20131004git.el7.x86_64.rpm
tar -xf mysql-5.7.44-1.el7.x86_64.rpm-bundle.tar
# 如果出现依赖问题使用 --force --nodeps
rpm -ivh mysql-community-common-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.44-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.44-1.el7.x86_64.rpm
启动服务并重设密码:
# systemctl start/stop/restart/status/enable/disable mysqld.service
service mysqld start
grep password /var/log/mysqld.log
# 上述命令会返回如下内容
# 2024-01-05T02:46:03.031076Z 1 [Note] A temporary password is generated for root@localhost: cMGsG#Csl1LB
# cMGsG#Csl1LB 即为临时密码
# 执行后输入临时密码
mysql -u root -h 127.0.0.1 -p
# 此时进入 MySQL 命令行 mysql>
# 重设密码
set global validate_password_policy=0;
set password = password("example");
use mysql;
update user set host = '%' where user = 'root';
flush privileges;
exit
按需修改参数配置:
vi /etc/my.cnf
重启服务:
service mysqld restart
设置时区:
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime