How to Upgrade MySQL 5.6 to 5.7 in Linux | MySQL Version Upgrade in Linux

From this article you will know how to upgrade MySQL 5.6 to 5.7 in Linux. Please go through the recommendation once before starting the actual database upgrade.

  • If your MySQL installation contains a large amount of data that might take a long time to convert after an in-place upgrade, it may be useful to create a test instance for assessing the conversions that are required and the work involved to perform them. To create a test instance, make a copy of your MySQL instance that contains the MySQL database and other databases without the data. Run the upgrade procedure on the test instance to assess the work involved to perform the actual data conversion.
  • Rebuilding and reinstalling MySQL language interfaces is recommended when you install or upgrade to a new release of MySQL. This applies to MySQL interfaces such as PHP MySQL extensions and the Perl DBD::mysql module.

To read more about this section please read my detailed MySQL Installation Document. Here I am describing these steps in short.

cd /d02/mysql/product/
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
tar xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
ln -s mysql-5.7.26-linux-glibc2.12-x86_64

Post Installation of MySQL 5.7, please do the following –

  1. Make changes in the my.cnf to reflect with 5.7.
  2. Stop MySQL 5.6 database.
  3. Start the 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/TEST/admin/my.cnf --user=mysql &
[1] 3442

Upgradation of 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.

Restart of MySQL Server

To Restart please use below command –

Stop : 
/d02/mysql/product/5.7.26/bin/mysqladmin -h127.0.0.1 -uroot -p shutdown
Start:
cd /d02/mysql/product/5.7.26/
bin/mysqld_safe --defaults-file=/mysqldatabase/TEST/admin/my.cnf --user=mysql &
Check the Version of the new instance post login -
mysql> select @@version;

Hope this document will help you for MySQL version upgrade on the Linux platform. 

Conclusion

The above article has provided you with enough information about how to upgrade MySQL 5.6 to 5.7. This is especially for beginners. By completing this tutorial, you can upgrade the MySQL version in Linux platforms.

Leave a Comment

Your email address will not be published. Required fields are marked *