舊版原本my.cnf的設置
basedir = /usr/local/mysql (安裝MYSQL服務的路徑)
datadir = /data/mysql (存放DB資料庫的路徑)
datadir = /data/mysql (存放DB資料庫的路徑)
第一步:先下載mysql5.7版本
[root@rosalie~]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.18- linux-glibc2.5-x86_64.tar.gzb
第二步:將下載的檔案,解壓並移動至/usr/local/下(-C指定直接移動到安裝的路徑)
[root@rosalie~]# tar zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
[root@rosalie~]# service mysql stop
第四步:mysql安裝的路徑下
[root@rosalie~]# cd /usr/local/
[root@rosalie local]# ll
total 48
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 13 root root 4096 Mar 23 2018 mysql -----原本5.6的版本安裝位置
drwxr-xr-x 9 root root 4096 Mar 25 16:58 mysql-5.7.18-linux-glibc2.5-x86_64 -----新的5.7版
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 5 root root 4096 Jan 9 2018 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
[root@rosalie local]# ll
total 48
drwxr-xr-x. 2 root root 4096 Sep 23 2011 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games
drwxr-xr-x. 2 root root 4096 Sep 23 2011 include
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib
drwxr-xr-x. 2 root root 4096 Sep 23 2011 lib64
drwxr-xr-x. 2 root root 4096 Sep 23 2011 libexec
drwxr-xr-x. 13 root root 4096 Mar 23 2018 mysql -----原本5.6的版本安裝位置
drwxr-xr-x 9 root root 4096 Mar 25 16:58 mysql-5.7.18-linux-glibc2.5-x86_64 -----新的5.7版
drwxr-xr-x. 2 root root 4096 Sep 23 2011 sbin
drwxr-xr-x. 5 root root 4096 Jan 9 2018 share
drwxr-xr-x. 2 root root 4096 Sep 23 2011 src
第五步:先將原本5.6更名,暫不先做移除,避免有問題(原名mysql改成mysql5.6)
[root@rosalie local]# mv /usr/local/mysql /usr/local/mysql5.6b
第六步:再將5.7的版本更名為mysql(剛下載下來的mysql-5.7......改成mysql)
[root@rosalie local]# mv /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql
改完可查詢一下目前MYSQL的版本
[root@rosalie local]# mysql -V
mysql Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86_64) using EditLine wrapper
改完可查詢一下目前MYSQL的版本
[root@rosalie local]# mysql -V
mysql Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86_64) using EditLine wrapper
第七步:然後COPY下載的5.7啟動檔配置,若想要共存請用更名的方式,單純更新用覆蓋
[root@rosalie local]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql5.7
[root@rosalie local]# cd /etc/init.d
[root@rosalie init.d]# ll
-rwxr-xr-x. 1 root root 10565 Mar 23 2018 mysqld ------- service mysqld start
-rwxr-xr-x 1 root root 10576 Mar 26 09:50 mysqld5.7 -------service mysqld5.7 start
*版本切換 *除了啟動方式不同紅字 *啟動前必需/usr/local/mysql 切換更名(參考第四步驟) *5.7升級後,若執行檢查升級相關參數,就不建議再切回5.6版本,下面指令b
[root@rosalie local]# cd /etc/init.d
[root@rosalie init.d]# ll
-rwxr-xr-x. 1 root root 10565 Mar 23 2018 mysqld ------- service mysqld start
-rwxr-xr-x 1 root root 10576 Mar 26 09:50 mysqld5.7 -------service mysqld5.7 start
*版本切換 *除了啟動方式不同紅字 *啟動前必需/usr/local/mysql 切換更名(參考第四步驟) *5.7升級後,若執行檢查升級相關參數,就不建議再切回5.6版本,下面指令b
第八步:mysql_upgrade 升級並檢查數據庫的相關參數
[root@rosalie~]# mysql_upgrade -uroot -p123456
第九步:啟動數據庫
[root@rosalie~]# service mysql5.7 start
Starting MySQL. SUCCESS!
測試升級成功
沒有留言:
張貼留言