Mysql5.6升级到5.7步骤详解

来源:互联网 发布:php reflection的作用 编辑:程序博客网 时间:2024/05/17 09:30

一、下载安装包

wget http://10.201.54.71/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

二、解压到/apps/svr/


三、软链接到/usr/local/

ln -s /apps/svr/mysql mysql57


四、停止5.6数据库运行

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#设置innodb_fast_shutdown=0
[root@rhel7 bin]# pwd
/usr/local/mysql57/bin
[root@rhel7 bin]# ./mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0"
Enter password: 
[root@rhel7 bin]# ./mysql -u root -p --execute="show global variables like 'innodb_fast_shutdown'"
Enter password: 
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 0     |
+----------------------+-------+
#关闭MySQL
[root@rhel7 bin]# ./mysqladmin -uroot -p shutdown 
Enter password: 
[root@rhel7 bin]# ps -ef |grep mysql
root      2771  1575  0 16:58 pts/0    00:00:00 grep --color=auto mysql

五、修改配置文件

 

1
2
3
#修改/etc/my.cnf文件
[root@rhel7 bin]# vi /etc/my.cnf
basedir = /usr/local/mysql57/ #basedir指向新的软件目录

 

六、修改~/.bash_profile

export PATH=/usr/local/mysql57/bin:$PATH

七、初始mysql库

 ./mysql_install_db --user=mysql --basedir=/usr/local/mysql57 --datadir=/usr/local/mysql57/data

  密码路径在/root/.mysql_secret

八、启动mysql

cd /apps/svr/mysql-5.7.17-linux-glibc2.5-x86_64

./bin/mysqld_safe --user=mysql &

九、升级mysql

./bin/mysql_upgrade -uroot -p

十、重启mysql

./bin/mysqladmin -uroot -p123456 shutdown 


问题:mysql5.7 mysql.user的密码字段改为authentication_string



参考资料:

1、http://hbxztc.blog.51cto.com/1587495/1879904

2、http://blog.csdn.net/u010860214/article/details/49448003

3、http://www.cnblogs.com/kerrycode/p/4368312.html

4、http://www.cnblogs.com/xujishou/p/6306765.html

5、http://blog.chinaunix.net/uid-21934320-id-3385844.html

6、http://blog.csdn.net/chenzenan/article/details/52829513

7、http://www.360doc.com/content/15/0201/17/15257968_445493382.shtml