In this post we will see how to upgrade MySQL Database Instance from MySQL 5.6 to MySQL 5.7

NOTE : If you are planning to upgrade in a Master-Slave Environment, please upgrade all Slave Environments first before upgrading Master Server database. Please stop the Slave process before starting the upgrade.

For more interesting posts on MySQL, please click on INDEX

Steps :

1. Download the latest MySQL 5.7.26 from the link
and then untar and create a soft link accordingly

cd /d02/mysql/product/
tar xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
ln -s mysql-5.7.26-linux-glibc2.12-x86_64


2. Make changes in the my.cnf to reflect with 5.7

3. Stop MySQL 5.6 database

4. Start database from 5.7 with the changed my.cnf file

bash-4.2$ cd /d02/mysql/product/5.7.26/
bash-4.2$ bin/mysqld_safe --defaults-file=/mysqldatabase/INFRA/admin/my.cnf --user=mysql &
[1] 3442


6. Upgrade the system tables

bash-4.2$ bin/mysql_upgrade -uroot -p
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
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.
INFRAart.bd_data                                   OK
log_files.cms_log_parse                            OK
log_files.error_string                             OK
log_files.log_file                                 OK
log_files.processing                               OK
log_files.servers                                  OK
online_routing.or_files                            OK
sys.sys_config                                     OK
Upgrade process completed successfully.
Checking if update is needed.


7. Restart the MySQL server

/d02/mysql/product/5.7.26/bin/mysqladmin -h127.0.0.1 -uroot -p shutdown

cd /d02/mysql/product/5.7.26/
bin/mysqld_safe --defaults-file=/mysqldatabase/INFRA/admin/my.cnf --user=mysql &


8. Check the version after logging into the instance

mysql> select @@version;