Summary of the table conversion storage engine Method

Source: Internet
Author: User


Note: After the storage engine is modified, the proprietary features of the original storage engine will be lost. For example, if an InnoDB is converted to the MyISAM storage engine and then returned, the foreign keys originally defined in the original InnoDB will be lost. Www.2cto.com method-1. alter table [SQL] mysql> ALTER TABLE mytable ENGINE = InnoDB; the simplest way to replace a TABLE with another storage ENGINE is the ALTER TABLE command. Features: a. Suitable for all storage engines. B. The conversion process takes a lot of time. C. The source table will be read and locked during conversion. Method 2: Dump and Import use mysqldump to export data tables and modify the create talbe statement of the Dump file. Modify: a. Delete the drop talbe statement in the dump file to prevent loss of source data when the dump fails. Www.2cto.com B. Modify the table name. The database definitely does not allow the same table name to appear, even if the storage engine is different. C. Modify the storage engine. Methods-3, CREATE, and SELECT have a balance between the speed of method-1 and the security of method-2. Create a table and use the INSERT... SELECT statement of mysql to transfer data. [SQL] mysql> CREATE TABLE innodb_table LIKE myisam_table; mysql> ALTER TABLE innodb_table ENGINE = InnoDB; mysql> INSERT INTO innodb_table SELECT * FROM myisam_table;
 

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.