Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redhat 6.5 mysql upgrade 5.5.48 implementation outline from mysql 5.6.32 to mysql 5.7.16

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1,os version

Redhat 6.5

2, the old version of mysql 5.5.48 creates the test database and test table

Mysql > create database zxy

Query OK, 1 row affected (0.00 sec)

Mysql > use zxy

Database changed

Mysql > create table t_zxy (an int)

Query OK, 0 rows affected (0.03 sec)

Mysql > insert into t_zxy values (1)

Query OK, 1 row affected (0.01sec)

Mysql > commit

Query OK, 0 rows affected (0.00 sec)

3. Query the old version of MYSQL 5.5.48 DATA DIR and related SOCKET files and PID

Mysql > show variables like 'datadir'

+-+ +

| | Variable_name | Value |

+-+ +

| | datadir | / var/lib/mysql/ |

+-+ +

1 row in set (0.00 sec)

Mysql > show variables like 'socket'

+-- +

| | Variable_name | Value |

+-- +

| | socket | / var/lib/mysql/mysql.sock |

+-- +

1 row in set (0.00 sec)

Mysql > show variables like'% pid%'

+-- +

| | Variable_name | Value |

+-- +

| | pid_file | / var/lib/mysql/mysqlupgrade.pid |

+-- +

1 row in set (0.01 sec)

4, the old version of MYSQL 5.5.48 did not use the configuration file my.cnf

[root@mysqlupgrade mysql_5548_dir] # ps-ef | grep-I mysql

Root 6563 5378 0 16:52 pts/0 00:00:00 / bin/sh / usr/bin/mysqld_safe-- user=root

Root 6643 6563 0 16:52 pts/0 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/var/lib/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=root

-log-error=/var/lib/mysql/mysqlupgrade.err-pid-file=/var/lib/mysql/mysqlupgrade.pid

Root 6712 5378 0 17:02 pts/0 00:00:00 grep-I mysql

[root@mysqlupgrade mysql_5548_dir] # ps aux | grep mysql | grep-I my.cnf

[root@mysqlupgrade mysql_5548_dir] #

5, the old version of mysql 5.5.48 executes innodb_fast_shutdown=0

[root@mysqlupgrade mysql_5548_dir] # mysql-u root-p-- execute='set global innodb_fast_shutdown=0'

Enter password:

[root@mysqlupgrade mysql_5548_dir] #

6 mysql shutdown previous version 5.5.48

[root@mysqlupgrade mysql_5548_dir] # mysqladmin-u root-p shutdown

Enter password:

180503 17:04:54 mysqld_safe mysqld from pid file / var/lib/mysql/mysqlupgrade.pid ended

[1] + Done mysqld_safe-- user=root

[root@mysqlupgrade mysql_5548_dir] # ps-ef | grep mysql

Root 6734 5378 0 17:04 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql_5548_dir] #

7, remove the old version of mysql 5.5.48

[root@mysqlupgrade mysql_5548_dir] # rpm-qa | grep-I mysql

MySQL-devel-5.5.48-1.el6.x86_64

MySQL-server-5.5.48-1.el6.x86_64

MySQL-client-5.5.48-1.el6.x86_64

[root@mysqlupgrade mysql_5548_dir] #

[root@mysqlupgrade mysql_5548_dir] # yum-y remove MySQL-client-5.5.48-1.el6.x86_64

[root@mysqlupgrade mysql_5548_dir] # yum-y remove MySQL-server-5.5.48-1.el6.x86_64

[root@mysqlupgrade mysql_5548_dir] # yum-y remove MySQL-devel-5.5.48-1.el6.x86_64

[root@mysqlupgrade mysql_5548_dir] # rpm-qa | grep-I mysql

[root@mysqlupgrade mysql_5548_dir] #

8, confirm the existence of the old version of MYSQL 5.5.48 DATA DIR and related

[root@mysqlupgrade mysql_5548_dir] # ll / var/lib/mysql

Total 28700

-rw-rw----. 1 root root 18874368 May 3 17:04 ibdata1

-rw-rw----. 1 root root 5242880 May 3 17:04 ib_logfile0

-rw-rw----. 1 root root 5242880 May 3 16:52 ib_logfile1

Drwx--x--x. 2 mysql mysql 4096 May 3 16:50 mysql

-rw-r-. 1 root root 2362 May 3 17:04 mysqlupgrade.err

Drwx-. 2 mysql mysql 4096 May 3 16:50 performance_schema

-rw-r--r--. 1 root root 111 May 3 16:50 RPM_UPGRADE_HISTORY

-rw-r--r--. 1 mysql mysql 111 May 3 16:50 RPM_UPGRADE_MARKER-LAST

Drwxr-xr-x. 2 mysql mysql 4096 May 3 16:50 test

Drwx-. 2 root root 4096 May 3 16:57 zxy

9, install intermediate version mysql 5.6.32

Slightly

[root@mysqlupgrade mysql5632_dir] # rpm-qa | grep-I mysql

MySQL-server-5.6.32-1.el6.x86_64

MySQL-client-5.6.32-1.el6.x86_64

[root@mysqlupgrade mysql5632_dir] #

10, start the intermediate version of mysql 5.6.32 with the old version of the data file directory

[root@mysqlupgrade mysql5632_dir] # mysqld_safe-user=root-datadir=/var/lib/mysql &

[1] 6830

[root@mysqlupgrade mysql5632_dir] # 180503 17:13:34 mysqld_safe Logging to'/ var/lib/mysql/mysqlupgrade.err'.

180503 17:13:34 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@mysqlupgrade mysql5632_dir] #

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep mysql

Root 6830 5378 0 17:13 pts/0 00:00:00 / bin/sh / usr/bin/mysqld_safe-- user=root-- datadir=/var/lib/mysql

Root 6918 6830 0 17:13 pts/0 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/var/lib/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=root-log-error=/var/lib/mysql/mysqlupgrade.err-pid-file=/var/lib/mysql/mysqlupgrade.pid

Root 6942 5378 0 17:14 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql5632_dir] #

11, upgrade intermediate version mysql 5.6.32 data dictionary and related metadata

[root@mysqlupgrade mysql5632_dir] # mysql_upgrade-u root-p

Enter password:

Looking for 'mysql' as: mysql

Looking for 'mysqlcheck' as: mysqlcheck

Running 'mysqlcheck with default connection arguments

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck with default connection arguments

Warning: Using a password on the command line interface can be insecure.

Mysql.columns_priv OK

Mysql.db OK

Mysql.event OK

Mysql.func OK

Mysql.general_log OK

Mysql.help_category OK

Mysql.help_keyword OK

Mysql.help_relation OK

Mysql.help_topic OK

Mysql.host OK

Mysql.ndb_binlog_index OK

Mysql.plugin OK

Mysql.proc OK

Mysql.procs_priv OK

Mysql.proxies_priv OK

Mysql.servers 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

Running 'mysql_fix_privilege_tables'...

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck with default connection arguments

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck with default connection arguments

Warning: Using a password on the command line interface can be insecure.

Zxy.t_zxy OK

OK

[root@mysqlupgrade mysql5632_dir] #

12min shutdown Intermediate version mysql 5.6.32

[root@mysqlupgrade mysql5632_dir] # mysqladmin-u root-p shutdown

Enter password:

180503 17:15:58 mysqld_safe mysqld from pid file / var/lib/mysql/mysqlupgrade.pid ended

[1] + Done mysqld_safe-user=root-datadir=/var/lib/mysql

[root@mysqlupgrade mysql5632_dir] #

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep mysql

Root 6971 5378 0 17:16 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep-I mysql

Root 6973 5378 0 17:16 pts/0 00:00:00 grep-I mysql

13, restart intermediate version mysql 5.6.32

[root@mysqlupgrade mysql5632_dir] # mysqld_safe-user=root-datadir=/var/lib/mysql &

[1] 6976

[root@mysqlupgrade mysql5632_dir] # 180503 17:17:05 mysqld_safe Logging to'/ var/lib/mysql/mysqlupgrade.err'.

180503 17:17:05 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep mysql

Root 6976 5378 0 17:17 pts/0 00:00:00 / bin/sh / usr/bin/mysqld_safe-- user=root-- datadir=/var/lib/mysql

Root 7064 6976 7 17:17 pts/0 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/var/lib/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=root-log-error=/var/lib/mysql/mysqlupgrade.err-pid-file=/var/lib/mysql/mysqlupgrade.pid

Root 7087 5378 0 17:17 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql5632_dir] #

14 to verify whether the intermediate version mysql 5.6.32 is running properly and whether the related data is upgraded completely

[root@mysqlupgrade mysql5632_dir] # mysql-u root-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 1

Server version: 5.6.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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 > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

| | zxy |

+-+

5 rows in set (0.00 sec)

Mysql > use zxy

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from t_zxy

+-+

| | a |

+-+

| | 1 |

+-+

1 row in set (0.00 sec)

Mysql >

15, it can be seen that the installation of intermediate version mysql 5.6.32 did not produce the configuration file my.cnf

[root@mysqlupgrade mysql5632_dir] # updatedb

[root@mysqlupgrade mysql5632_dir] # locate my.cnf

/ etc/my.cnf.d

[root@mysqlupgrade mysql5632_dir] #

16, intermediate version mysql 5.6.32 innodb_fast_shutdown

[root@mysqlupgrade mysql5632_dir] #! 40

Mysql-u root-p-- execute='set global innodb_fast_shutdown=0'

Enter password:

[root@mysqlupgrade mysql5632_dir] #

17 mysql shutdown Intermediate version 5.6.32

[root@mysqlupgrade mysql5632_dir] #! 41

Mysqladmin-u root-p shutdown

Enter password:

180503 17:20:31 mysqld_safe mysqld from pid file / var/lib/mysql/mysqlupgrade.pid ended

[1] + Done mysqld_safe-user=root-datadir=/var/lib/mysql

[root@mysqlupgrade mysql5632_dir] #

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep mysql

Root 7108 5378 0 17:20 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql5632_dir] # ps-ef | grep-I mysql

Root 7110 5378 0 17:20 pts/0 00:00:00 grep-I mysql

[root@mysqlupgrade mysql5632_dir] #

18, remove intermediate version mysql 5.6.32

[root@mysqlupgrade mysql5632_dir] # rpm-qa | grep-I mysql

MySQL-server-5.6.32-1.el6.x86_64

MySQL-client-5.6.32-1.el6.x86_64

[root@mysqlupgrade mysql5632_dir] #

Yum-y remove MySQL-server-5.6.32-1.el6.x86_64

Yum-y remove MySQL-client-5.6.32-1.el6.x86_64

[root@mysqlupgrade mysql5632_dir] # rpm-qa | grep-I mysql

[root@mysqlupgrade mysql5632_dir] #

19, install the new version of mysql 5.7.16

Slightly

[root@mysqlupgrade mysql_new_version_dir] # rpm-qa | grep mysql

Mysql-community-client-5.7.16-1.el6.x86_64

Mysql-community-libs-5.7.16-1.el6.x86_64

Mysql-community-server-5.7.16-1.el6.x86_64

Mysql-community-common-5.7.16-1.el6.x86_64

[root@mysqlupgrade mysql_new_version_dir] #

20, start the new version of mysql 5.7.16 with the old version of the data file directory

[root@mysqlupgrade mysql_new_version_dir] # mysqld_safe-user=root-datadir=/var/lib/mysql &

[1] 7153

[root@mysqlupgrade mysql_new_version_dir] # 2018-05-03T09:24:58.397790Z mysqld_safe Logging to'/ var/log/mysqld.log'.

2018-05-03T09:24:58.423138Z mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@mysqlupgrade mysql_new_version_dir] # ps-ef | grep mysql

Root 7153 5378 0 17:24 pts/0 00:00:00 / bin/sh / usr/bin/mysqld_safe-- user=root-- datadir=/var/lib/mysql

Root 7311 7153 5 17:24 pts/0 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/var/lib/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=root-log-error=/var/log/mysqld.log-pid-file=/var/run/mysqld/mysqld.pid-socket=/var/lib/mysql/mysql.sock

Root 7340 5378 0 17:25 pts/0 00:00:00 grep mysql

21, upgrade the new version of mysql 5.7.16 data dictionary and related metadata

[root@mysqlupgrade mysql_new_version_dir] # mysql_upgrade-u root-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

Zxy.t_zxy OK

Upgrade process completed successfully.

Checking if update is needed.

[root@mysqlupgrade mysql_new_versio

22, close the new version of mysql 5.7.16

[root@mysqlupgrade mysql_new_version_dir] # mysqladmin-u root-p shutdown

Enter password:

[root@mysqlupgrade mysql_new_version_dir] # 2018-05-03T09:26:28.321222Z mysqld_safe mysqld from pid file / var/run/mysqld/mysqld.pid ended

[1] + Done mysqld_safe-user=root-datadir=/var/lib/mysql

[root@mysqlupgrade mysql_new_version_dir] # ps-ef | grep-I mysql

Root 7353 5378 0 17:26 pts/0 00:00:00 grep-I mysql

[root@mysqlupgrade mysql_new_version_dir] #

23, restart the new version of mysql 5.7.16

[root@mysqlupgrade mysql_new_version_dir] # mysqld_safe-user=root-datadir=/var/lib/mysql &

[1] 7356

[root@mysqlupgrade mysql_new_version_dir] # 2018-05-03T09:26:51.813308Z mysqld_safe Logging to'/ var/log/mysqld.log'.

2018-05-03T09:26:51.835876Z mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql

[root@mysqlupgrade mysql_new_version_dir] # ps-ef | grep mysql

Root 7356 5378 0 17:26 pts/0 00:00:00 / bin/sh / usr/bin/mysqld_safe-- user=root-- datadir=/var/lib/mysql

Root 7514 7356 3 17:26 pts/0 00:00:00 / usr/sbin/mysqld-basedir=/usr-datadir=/var/lib/mysql-plugin-dir=/usr/lib64/mysql/plugin-user=root-log-error=/var/log/mysqld.log-pid-file=/var/run/mysqld/mysqld.pid-socket=/var/lib/mysql/mysql.sock

Root 7543 5378 0 17:26 pts/0 00:00:00 grep mysql

[root@mysqlupgrade mysql_new_version_dir] #

24 to verify whether the new version of mysql 5.7.16 is running properly and whether the related data is upgraded completely

[root@mysqlupgrade mysql_new_version_dir] # mysql-u root-p

Enter password:

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 2

Server version: 5.7.16 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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 > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | sys |

| | test |

| | zxy |

+-+

6 rows in set (0.00 sec)

Mysql > use zxy

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > select * from t_zxy

+-+

| | a |

+-+

| | 1 |

+-+

1 row in set (0.00 sec)

Mysql >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report