Three methods to modify database engine _ MySQL

Source: Internet
Author: User
Three methods to modify the database engine bitsCN.com

Three methods to modify the database engine

1. directly alter table

SQL code

Alter table youTable ENGINE = InnoDB;

This method is the easiest, but it takes a long time for a big data table, because MySQL needs to perform row-by-row replication from the old table to the new table. MySQL locks the entire table regardless of the engine used to operate the alter table operation.

2. use dump and source

First, dump the required TABLE, then modify the dump file, remove drop table, modify the create table code, and execute source.

In this way, the engine cannot be modified online, and the database must be deprecated or synchronized after being modified online.

3. use CREATE and SELECT

SQL code

Create table myTableCopy LIKE myTable;

Alter table myTableCopy ENGINE = InnoDB;

Insert into myTableCopy SELECT * FROM myTable WHERE id BETWEEN x AND y;

In this way, when the table data volume is large, you can import data in batches according to the range without locking myTable.

BitsCN.com

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.