How to convert MySQL database MyISAM storage engine to Innodb

Source: Internet
Author: User

When the mysql database storage engine is MyISAM, data tables may be locked in the case of large traffic volumes, which may cause users to return 502 when they connect to the website, in this case, you need to convert the MySQL database MyISAM storage engine to Innodb.
The procedure is as follows:

1,Export the table structure of the CentOS Database

Copy codeThe Code is as follows: mysqldump-d-uxxx-p centos> centos_table. SQL
The-d parameter indicates that no data is exported, and only the table structure is exported.

2,Replace MyISAM in centos_table. SQL with INNODB

Copy codeThe Code is as follows: sed-I's/MyISAM/INNODB/G' centos_table. SQL

3,Create a database centos_new and import the table structure

Copy codeThe Code is as follows: mysql> create database centos_new;
Mysql-uroot-p centos_new <centos_table. SQL
You can use show table status to check whether the engine is INNODB.

4,Export centos data

Copy codeThe Code is as follows: mysqldump-t-uroot-p centos> centos_data. SQL
The-t parameter indicates that only data is imported, and the table structure is not imported.

5,Import data to centos_new

Copy codeThe Code is as follows: mysql-uroot-p centos_new <centos_data. SQL

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.