Table conversion storage engine method summary _ MySQL
Source: Internet
Author: User
Summary of the table conversion storage engine method bitsCN.com
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. Method 1: alter table [SQL] mysql> ALTER TABLE mytable ENGINE = InnoDB; the easiest way to replace a TABLE from one storage ENGINE 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. 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;
BitsCN.com
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