8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
Home » Articles » Mysql » Here
MySQL : Upgrade MySQL 5.6 to 5.7
This article gives an overview of the steps needed to perform an in-place upgrade of MySQL 5.6 to 5.7. There are a number of prerequisites and caveats associated with this process, so you really need to check the documentation before attempting an upgrade.
Do a clean shutdown of the mysqld
service.
# mysql --user root --password --execute="set global innodb_fast_shutdown=0" # service mysqld stop
Take a physical backup at this point. This will allow you to recovery should anything go wrong. Also, take a copy of your "/etc/my.cnf" file.
It's really important you get a good backup and practice your recovery scenario before trying this. If something goes wrong, you will probably have to reinstall MySQL 5.6 and recreate your database before trying again. You will need backups to do this!
Install the MySQL 5.7 repository and use YUM to update the binaries.
# rpm -Uvh /tmp/mysql57-community-release-el6-7.noarch.rpm # yum update mysql-community-server -y
If the installation of the repository package fails with dependency errors, delete the existing software and install the new new version.
# yum remove mysql-community-server -y # rpm -Uvh /tmp/mysql57-community-release-el6-7.noarch.rpm # yum install mysql-community-server -y
This brings all the dependent packages with it, so at least the following will be updated.
- mysql-community-server
- mysql-community-client
- mysql-community-common
- mysql-community-libs
- mysql-community-libs-compat
Start the mysqld
service.
# service mysqld start
Upgrade database by running the mysql_upgrade
command. Before you do this, you might want to redirect the output to a script so you can check for errors.
# script /tmp/upgrade.txt # mysql_upgrade --password Enter password: Checking if update is needed. Checking server version. Running queries to upgrade MySQL server. Checking system database. mysql.columns_priv OK mysql.db OK mysql.engine_cost OK mysql.event OK mysql.func OK mysql.general_log OK mysql.gtid_executed 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.server_cost 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 Upgrading the sys schema. Checking databases. mydatabase1.mytable_1 OK ... mydatabase1.mytable_x OK sys.sys_config OK mydatabase2.mytable_1 OK ... mydatabase2.mytable_x OK Upgrade process completed successfully. Checking if update is needed. # # # end script command using exit. # exit #
Check the "/tmp/upgrade.txt" file for errors. If everything is OK, the upgrade is now complete. It would make sense to take another backup at this point.
For more information see:
Hope this helps. Regards Tim...