从5.6升级到5.7
步骤:
1. dump (5.6)
/usr/local/mysql5.6/bin/mysqldump -uroot -p -S /tmp/mysql3308.sock --single-transaction -A >all.sql
2. 新库建好进入:source (5.7)
3. 5.7关库
/usr/local/mysql/bin/mysqladmin -S /tmp/mysql3307.sock shutdown
4. 启动以 --skip-grant-tables
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --skip-grant-tables --user=mysql&
5. /usr/local/mysql/bin/mysql_upgrade -S /tmp/sock
更新(升级)权限表(升级后密码也过来了)
/usr/local/mysql/bin/mysql_upgrade -S /tmp/mysql3307.sock
7.关库
/usr/local/mysql/bin/mysqladmin -S /tmp/mysql3307.sock shutdown
8.重启
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my3307.cnf --user=mysql&
/usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3307.sock
此文档建立在业务可以停的情况下,保证备份的数据就是全部的数据,而后业务没有进行改动的,如果业务不能停止,那么需要给原库搭建主从,这样数据可以一直同步。然后选择个合适的时间点停止业务。
来源:https://www.cnblogs.com/feifeizouzou/p/8630870.html