We are going to upgrade my MySQL server 5.5.62 running on On my Oracle Linux 7 to MySQL server to 5.7.26.
Table of Contents:
- check my current version
- Backup my databases
- Install the new MySQL server version
- Upgrade my data
1. check my current version:
a. We are using Oracle Linux 7:
# cat /etc/oracle-release
Oracle Linux Server release 7.5
# uname -a
Linux MySQL-server 4.1.12-124.18.6.el7uek.x86_64 #2 SMP Wed Aug 15 19:12:26 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux
b. My Curring MySQL server version is 5.5.62
# rpm -qa|grep -i mysql
MySQL-server-5.5.62-1.el7.x86_64
MySQL-client-5.5.62-1.el7.x86_64
c. Check my MySQL server status
# mysql -uroot -pmysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.62 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status
mysql Ver 14.14 Distrib 5.5.62, for Linux (x86_64) using readline 5.1
Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.62 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 1 min 14 sec
Threads: 1 Questions: 9 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.121
mysql>
2. Backup my Databases before the upgrade:
We have used the mysqldump tool to make a full databases backup:
# mysqldump -uroot -p --routines --events --flush-privileges --all-databases > all-db-5.5.sql
Stop and remove my old MySQL version:
# rpm -e MySQL-server-5.5.62-1.el7.x86_64
# rpm -e MySQL-client-5.5.62-1.el7.x86_64
3. Install the new MySQL server version 5.7.26:
a. We are going to install the MySQL server version 5.7.26
# rpm -Uvh mysql-community-common-5.7.26-1.el7.x86_64.rpm
# rpm -Uvh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
# rpm -Uvh mysql-community-client-5.7.26-1.el7.x86_64.rpm
# rpm -Uvh mysql-community-server-5.7.26-1.el7.x86_64.rpm
b. Check the new client version:
# mysql -V
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
c. Start the new MySQL server:
# systemctl start mysqld
4. Upgrade the MySQL server metadata:
We are going to use the mysql_upgrade command to upgrade the mysql serrver data to the new version. for more info of mysql_upgrade.
# mysql_upgrade -uroot -p
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.host 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.
sys.sys_config OK
world_innodb.City OK
world_innodb.Country OK
world_innodb.CountryLanguage OK
Upgrade process completed successfully.
Checking if update is needed.
Check now the new running version:
# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> status;
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
Connection id: 2
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.26 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 37 sec
Threads: 1 Questions: 5 Slow queries: 0 Opens: 105 Flush tables: 1 Open tables: 98 Queries per second avg: 0.135
mysql> exit
Bye
Conclusion:
We have upgraded my MySQL server databases from the version 5.5 to 5.7 on Oracle Linux 7.
Pingback: Restore MySQL 5.7 Backup with MySQL Enterprise Backup MEB 4.1.0 | Wadhah DAOUEHI