您好,登錄后才能下訂單哦!
mysql5.6怎么升級(jí)到mysql5.7,相信很多沒(méi)有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問(wèn)題出現(xiàn)的原因和解決方法,通過(guò)這篇文章希望你能解決這個(gè)問(wèn)題。
1、停止mysql5.6數(shù)據(jù)庫(kù)服務(wù)
[root@host2 mysql]# /etc/init.d/mysqld stop Shutting down MySQL.. [ OK ] [root@host2 mysql]#
2、進(jìn)入/usr/local更換軟連接指定到mysql5.7
[root@host2 local]# ls bin games lib libexec mysql mysql-5.7.16-linux-glibc2.5-x86_64 mysql-utilities-1.6.5.tar.gz share etc include lib64 my.cnf mysql-5.6.34-linux-glibc2.5-x86_64 mysql-utilities-1.6.5 sbin src [root@host2 local]# unlink mysql
創(chuàng)建新的鏈接
[root@host2 local]# ln -s mysql-5.7.16-linux-glibc2.5-x86_64 mysql [root@host2 local]# ll total 712 drwxr-xr-x. 2 root root 4096 Jun 28 2011 bin drwxr-xr-x. 2 root root 4096 Jun 28 2011 etc drwxr-xr-x. 2 root root 4096 Jun 28 2011 games drwxr-xr-x. 2 root root 4096 Jun 28 2011 include drwxr-xr-x. 2 root root 4096 Jun 28 2011 lib drwxr-xr-x. 2 root root 4096 Jun 28 2011 lib64 drwxr-xr-x. 2 root root 4096 Jun 28 2011 libexec -rw-r--r--. 1 root root 2754 Nov 6 15:44 my.cnf lrwxrwxrwx. 1 root root 34 Mar 8 15:34 mysql -> mysql-5.7.16-linux-glibc2.5-x86_64 drwxr-xr-x. 12 mysql mysql 4096 Feb 27 18:33 mysql-5.6.34-linux-glibc2.5-x86_64 drwxr-xr-x. 11 root mysql 4096 Nov 19 00:01 mysql-5.7.16-linux-glibc2.5-x86_64 drwxr-xr-x. 7 7161 31415 4096 Feb 28 02:00 mysql-utilities-1.6.5 -rw-r--r--. 1 root root 668241 Feb 28 01:59 mysql-utilities-1.6.5.tar.gz drwxr-xr-x. 2 root root 4096 Jun 28 2011 sbin drwxr-xr-x. 5 root root 4096 Nov 6 22:15 share drwxr-xr-x. 2 root root 4096 Jun 28 2011 src
3、啟動(dòng)數(shù)據(jù)庫(kù)并進(jìn)入數(shù)據(jù)庫(kù)
[root@host2 local]# /etc/init.d/mysqld start Starting MySQL.............................................[ OK ].............................. [root@host2 local]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.16-log MySQL Community Server (GPL)
(可以看到數(shù)據(jù)庫(kù)已經(jīng)到5.7版本了)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. 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>
4、更新數(shù)據(jù)結(jié)構(gòu)(生產(chǎn)環(huán)境使用mysql_upgrade更新的時(shí)候加-s參數(shù) 不重建表)
[root@host2 local]# mysql_upgrade -p123 -s mysql_upgrade: [Warning] Using a password on the command line interface can be insecure. The --upgrade-system-tables option was used, databases won't be touched. Checking if update is needed. Checking server version. Running queries to upgrade MySQL server. Upgrading the sys schema. Upgrade process completed successfully. Checking if update is needed.
至此升級(jí)成功
5、進(jìn)入數(shù)據(jù)庫(kù)查看
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | | test | +--------------------+ 可以看到sys庫(kù)已經(jīng)存在,但是直接安裝的5.7的庫(kù)是沒(méi)有test庫(kù)的,這里sys和test同時(shí)存在說(shuō)明是從5.6升級(jí)到5.7
看完上述內(nèi)容,你們掌握mysql5.6怎么升級(jí)到mysql5.7的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。