1.本地升級(5.7升級到8.0)
1.1停止mysql服務(wù)
[root@db01 ~]# /etc/init.d/mysqld stop
Shutting down MySQL.. SUCCESS!
1.2備份全庫(冷備)
[root@db01 ~]# cp -r /data/mysql/data /opt/
[root@db01 ~]# ll /opt/
total 4
drwxr-xr-x 6 root root 176 Aug 15 15:58 data
-rw-r--r-- 1 root root 127 Aug 15 09:50 my.cnf
1.3部署高版本軟件
- 1.3.1上傳高版本軟件
[root@db01 /application]# rz -E
rz waiting to receive.
[root@db01 /application]# ll
total 1079692
drwxr-xr-x 9 root root 129 Aug 13 17:06 mysql
-rw-r--r-- 1 root root 644869837 Aug 10 09:53 mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
-rw-r--r-- 1 root root 460733332 Aug 10 14:14 mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
- 1.3.2解壓軟件并重命名
[root@db01 /application]# tar xf mysql-8.0.16-linux-glibc2.12-x86_64.tar.xz
[root@db01 /application]# mv mysql-8.0.16-linux-glibc2.12-x86_64 mysql8
- 1.3.3修改配置文件和環(huán)境變量
[root@db01 /application]# cat /etc/my.cnf
[mysqld]
user=mysql
basedir=/application/mysql8
datadir=/data/mysql/data
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
[root@db01 ~]# vim /etc/profile
export PATH=/application/mysql8/bin:$PATH
[root@db01 ~]# source /etc/profile
- 1.3.4目錄授權(quán)
[root@db01 ~]# chown -R mysql.mysql /application/mysql8
- 1.3.5升級數(shù)據(jù)
A.5.6---->5.7版本升級
1.啟動(dòng)數(shù)據(jù)庫
[root@db01 ~]# /etc/init.d/mysqld start
2.執(zhí)行數(shù)據(jù)升級命令
[root@db01 ~]# mysql_upgrade
B.5.6---->8.0版本升級
1.啟動(dòng)數(shù)據(jù)庫
[root@db01 ~]# /etc/init.d/mysqld start
注:在數(shù)據(jù)庫啟動(dòng)的過程中就軟件自從完成了數(shù)據(jù)的升級渠脉!