======Overview======
MySQL upgrade is fairly easy and it is mostly done by updating the RPMs, this can be accomplished either via:
* Using YUM/DNF repository
* APT Repository
* Directly downloaded RPM packages
We will use the YUM approach:
====Updating the RPMs====
The RPMs are updated as normally via the following command:
yum update mysql-server
After the packages are updated you can check the latest which were installed:
[root@stage-db software]# yum list installed | grep mysql
mysql-community-client.x86_64 5.7.21-1.el7 @mysql57-community
mysql-community-common.x86_64 5.7.21-1.el7 @mysql57-community
mysql-community-libs.x86_64 5.7.21-1.el7 @mysql57-community
mysql-community-libs-compat.x86_64
5.7.21-1.el7 @mysql57-community
mysql-community-server.x86_64 5.7.21-1.el7 @mysql57-community
mysql-connector-python.x86_64 2.1.7-1.el7 @mysql-connectors-community
mysql-utilities.noarch 1.6.5-1.el7 @mysql-tools-community
mysql57-community-release.noarch el7-10 @mysql57-community
[root@stage-db software]#
====Running the postupdate script====
After the RPM has been updated and the mysql restart, you have to run the mysql_upgrade script in order to recompile, if needed, the tables/views/procedures to affect the recent changes.
[root@stage-db software]# mysql_upgrade -uroot -p
Enter password:
Checking if update is needed.
***************************************************************
vdepta.sys_payment_methods OK
vdepta.sys_results_btypes OK
vdepta.sys_server_status_logs OK
vdepta.sys_templates OK
vdepta.sys_trading_hours OK
vdepta.sys_user_ips OK
vdepta.sys_user_sessions OK
vdepta.sys_user_sessions_backup OK
vdepta.sys_user_types OK
vdepta.sys_users OK
vdepta.sys_users_activation OK
vdepta.sys_users_info OK
Upgrade process completed successfully.
Checking if update is needed.
Once the script has been executed feel free to re-run the command so you can check if everything is OK:
[root@stage-db software]# mysql_upgrade -uroot -p
Enter password:
Checking if update is needed.
This installation of MySQL is already upgraded to 5.7.21, use --force if you still need to run mysql_upgrade
[root@stage-db software]#