1.备份
(略。)
2.安装8.0软件到新位置
[root@db01 /application]#mv mysql-8.0.16-linux-glibc2.12-x86_64 mysql8
3.停原库
[root@db01 /application]#systemctl stop mysqld
4.修改已有配置
共修改三处配置文件
mysql 改为mysql8
[root@db01 ~]#vim /etc/profile
export PATH=/application/mysql8/bin:$PATH
[root@db01 /application]#source /etc/profile
[root@db01 /application]#mysql -V
mysql Ver 8.0.16 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
[root@db01 /application]#vim /etc/my.cnf
[mysqld]
user=mysql
basedir=/application/mysql8
datadir=/data/3306/data
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
[root@db01 /application]#vim /etc/systemd/system/mysqld.service
[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/application/mysql8/bin/mysqld --defaults-file=/etc/my.cnf
LimitNOFILE = 5000
systemctl stop mysqld.service
systemctl start mysqld
5.恢复5.7.26版本
- 把三处配置文件改回去
- 初始化命令:mysqld --initialize-insecure --user=mysql --basedir=/application/mysql --datadir=/data/3306/data
-
重启
systemctl stop mysqld.service
systemctl start mysqld