CentOS 6.9 upgrade MySQL from 5.6.36 to 5.7.18, centos5.7.18

Source: Internet
Author: User

CentOS 6.9 upgrade MySQL from 5.6.36 to 5.7.18, centos5.7.18

CentOS 6.9 upgrade MySQL from 5.6.36 to 5.7.18

MySQL 5.6.36 installation: http://www.cnblogs.com/imweihao/p/7156754.html

Easy to upgrade

1. Close the database safely

[Root @ 001 ~] # Service mysqld stop

2. Upload mysql5.7.18 to the server and decompress it to/usr/local.

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

3. Cancel the 5.6 soft connection and create a 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 to prevent future rollback. If you want to roll back the version, you only need to replace mysql_old with mysql, follow these steps:

[Root @ 001 local] # service mysqld start

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

4. the above steps have actually been upgraded and can be started successfully, but only ensure that the data files are compatible. Use mysql_upgrade to upgrade 5.6 of files to 5.7

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

# The-s parameter must be added, indicating that only system tables are updated. If-s is not added, all database tables are rebuilt in the form of 5.7.9. do not perform this operation online.
# Because the database binary files are compatible, no upgrade is required.
# When do I not need-s? When some old versions of storage format require new features,
#-S is not added for performance improvement.
# This method is recommended even if you use slave for upgrade, which is faster

[Root @ 001 local] # mysql-V # view mysql version

Upgrade successful !!!

Note: If the original data binaries are saved in the/usr/local/mysql-5.6.27-linux-glibc2.5-x86_64/data directory, before the upgrade, either copy the data from this directory to the new data directory you specified (such as/usr/local/mysql-5.7.9-linux-glibc2.5-x86_64/data) or modify my. cnf, point datadir to/usr/local/mysql-5.6.27-linux-glibc2.5-x86_64/data, in short make sure my. the Data Location in cnf is consistent with your actual data location, either by default or specified by your datadir.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.