Home  >  Article  >  Database  >  CentOS 6.9 upgrades MySQL 5.6.36 to 5.7.18

CentOS 6.9 upgrades MySQL 5.6.36 to 5.7.18

PHP中文网
PHP中文网Original
2017-07-13 18:14:181139browse

CentOS 6.9 UpgradeMySQL 5.6.36 to5.7.18

MySQL 5.6.36 Installation process:

The upgrade method is very simple

1, Safely close the database

[root@001 ~]# service mysqld stop

2, upload mysql5.7.18 to the server and extract it to /usr/local

[root@001 ~]# tar zxf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/

3, cancel the soft connection of 5.6, and establish 5.7 New link

[root@001 ~]# cd /usr/local/

[root@001 local]# unlink mysql

[root@001 local]# ln -sv mysql-5.7.18-linux-glibc2.5-x86_64/ mysql

[root@001 local]# cp -rf /data/mysqldata/mysql mysql_old #Back up here first to prevent the later stage If you want to roll back the version, just replace the backup mysql_old with mysql, and then follow the steps below

[root@001 local]# service mysqld start

Starting MySQL........................................ ....SUCCESS!

4. The above steps have actually been successfully upgraded and can be started successfully, but they can only guarantee that the data files will be compatible. You need to use mysql_upgrade to upgrade the files of 5.6 to 5.7

[root@001 local]# mysql_upgrade -uroot -p

#The parameter -s must be added, which means that only the system table will be updated. If -s is not added, the tables of all libraries will be rebuilt in the 5.7.9 method. Never do this online
#Because the database binary files are compatible, there is no need to upgrade
#When is -s not needed? When some older versions of the storage format require new features ,
# To improve performance, do not add -s
# Even if you upgrade through slave, it is recommended to use this method to upgrade, which is faster

[root@001 local]# mysql -V #Viewmysqlversion

update successed! ! !

Notice:
If the original data binary file is saved in the /usr/local/mysql-5.6.27-linux-glibc2.5-x86_64/data directory, before upgrading, either copy the data in this directory to the new one The data directory you specified (such as /usr/local/mysql-5.7.9-linux-glibc2.5-x86_64/data), or modify my.cnf and point the datadir to /usr/local/mysql-5.6.27-linux -glibc2.5-x86_64/data, in short, make sure that the data location in my.cnf is consistent with your actual data location, whether it is the default or the one specified by your datadir

The above is the detailed content of CentOS 6.9 upgrades MySQL 5.6.36 to 5.7.18. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn