mysql 5.6到percona 5.6小版本升级

假设原来是mysql 5.6.19社区版,现在要升级到percona server 5.6.30。

对于大的数据库来说,采用mysqldump方式进行迁移太花费时间了,可采用新安装加载原来数据库的方式大大节约升级时间。

对于mysql升级来说,一个主要的步骤就是升级后权限的同步更新以及数据表的校验。

假设原来为/usr/local/mysql-> mysql-5.6.19-linux-glibc2.5-x86_64,数据库在data目录下。

0、停止现有实例,/usr/local/mysql/bin/mysqladmin -u -p shutdown

1、首先,删除原来的符号链接rm rf /usr/local/mysql;

2、解压Percona-Server-5.6.30-rel76.3-Linux.x86_64.ssl101.tar.gz到当前目录;

3、创建新的符号链接ln -s Percona-Server-5.6.30-rel76.3-Linux.x86_64.ssl101 mysql

4、更改my.cnf,去掉datadir、basedir注释,如下:

basedir = /usr/local/mysql #指向最新的mysql实例

datadir = /usr/local/mysql-5.6.19-linux-glibc2.5-x86_64/data 指向原来的mysql数据库目录

其他配置可以保持不变。。。

5、使用新的安装包创建启动mysql实例:/usr/local/mysql/bin/mysqld_safe --user=mysql &

6、执行mysql_upgrade

[root@localhost bin]# ./mysql_upgrade -uroot -p
Warning: Using a password on the command line interface can be insecure.
Looking for 'mysql' as: ./mysql
Looking for 'mysqlcheck' as: ./mysqlcheck
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Running 'mysql_fix_privilege_tables'...
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
Running 'mysqlcheck with default connection arguments
Warning: Using a password on the command line interface can be insecure.
mig_db.mig_tab                                     OK
mig_db.mig_tab2                                    OK
OK

7、重启mysql实例。

8、客户端验证,可发现所有数据和存储过程均正常。

上一篇:SQL truncate/delete/drop 区别


下一篇:通过ajax上传文件