MySQL Upgrade Method Guide Encyclopedia 1th 5 page _mysql

Source: Internet
Author: User
If all are newer versions of the upgrade can refer to the following article,
The MySQL database version is updated quickly, the new features are constantly being updated, and the main thing is to solve many of the bugs that affect our application, and in order to make our MySQL a better place, we need to upgrade it, although you would say that it is now running well and steadily enough. Let's take a look at several common upgrade methods.

Before introducing, let's make some declarations, MySQL uses binary package to install, upgrades are operated on the same DB server.

The first, very simple, applies to any storage engine.

1. Download and install the new version of the MySQL database, and change its port to 3307 (avoid the previous version of the 3306 conflict), start the service.

2. Create a database with the same name under a new version.

# Mysqldump-p3307-uroot Create mysqlsystems_com

3. Back up the database under the old version.

# mysqldump-p3306-uroot mysqlsystems_com > MYSQLSYSTEMS_COM.BK

Note: You can also add the –opt option so that you can use the optimization method to export your database to reduce unknown problems.

4. Import the exported database backup into the new version of the MySQL database.

# Mysql-p3307-uroot Mysqlsystems_com < MYSQLSYSTEMS_COM.BK

5. Overwrite the MySQL database in the data directory of the old version database to the new version.

# Cp-r/opt/mysql-5.1/data/mysql/opt/mysql-5.4/data

Note: We all know the importance of this default database.

6. In the new version of the implementation of the Mysql_upgrade command, in fact, this command contains three commands:

# Mysqlcheck–check-upgrade–all-databases–auto-repair
# Mysql_fix_privilege_tables
# Mysqlcheck–all-databases–check-upgrade–fix-db-names–fix-table-names

Note: In each upgrade process, Mysql_upgrade This command we should all do, it through the Mysqlcheck command to help us check whether the table is compatible with the new version of the database and fix, there is also a very important role is to use the Mysql_fix_ Privilege_tables command to upgrade the permission table.

7. Turn off the old version, change the new version of the database using the port to 3306 and restart the MySQL database. In this case, the database upgrade in a simple environment is over.


the second, the same applies to any storage engine.

1. Also install the new version of MySQL first.

2. In the old version, back up the database.

# MKDIR/OPT/MYSQLSYSTEMS_BK; MYSQLDUMP-P3306-UROOT–TAB=/OPT/MYSQLSYSTEMS_BK mysqlsystems_com

The Note:–tab option can generate two types of files suffix *.sql and *.txt under the backup directory MYSQLSYSTEMS_BK, where. SQL saves the SQL statement that created the table and. TXT preserves the original data.

3. Next, update the data under the new version of the database.

# Mysqladmin-p3307-uroot Create mysqlsystems_com

# Cat/opt/mysqlsystems_bk/*.sql | Mysql-p3307-uroot mysqlsystems_com (Create Tables)

# Mysqlimport Mysqlsystems_com/opt/mysqlsystems_bk/*.txt (Load Data)

4. All subsequent steps are the same as those in the first three steps 5, 6, and 7.

The third is for MyISAM storage engines, all of which are copies between files.

1. Installation.

2. From the old version of the mysqlsystems_com database, all. frm,. MyD and. myi files are copied to the same directory as the new version.

3. The subsequent steps remain the same as in the first three stages.

The above are three ways to upgrade MySQL, there seems to be no problem, in fact, in the actual production environment, there will be a number of problems, which requires us to fully understand the new version of new features before the upgrade, further analysis of the upgrade after the new features will affect our original application

For older versions of MySQL upgrades you can look at the next page.
Current 1/5 page 12345 Next read the full text
Related Article

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.