MySQL Modify table storage engine security practices

Source: Internet
Author: User

1. True connection modification. It is slower when there is more data, and can affect read performance when modified. My_table is the table of operations, InnoDB is the new storage engine.

The code is as follows Copy Code

ALTER TABLE my_table engine=innodb2.

Export, import. This is easier to operate, directly to the lead out of the SQL file to change, and then guide back. With Mysqldump, Feng elder brother is commonly used is navicate so easier to use. Friendship Alert is a big risk.

3. Create, insert. This is faster than the first, safety is higher than the second, recommended. 2-Step operation

A. Create a table, first create a table that is the same as the table you want to manipulate, and then change the storage engine as the target engine.

The code is as follows Copy Code

CREATE TABLE my_tmp_table like my_table;
ALTER TABLE my_tmp_table Engine=innodb;

B. Insert. For security and speed, it is best to add transactions and limit the scope of the ID (primary key).

The code is as follows Copy Code

INSERT into my_tmp_table SELECT * from my_table;

All right, MySQL. Modify table storage Engine practice here, the final method is to use the temporary table to do, of course, if you do not want to do this can first back up the data, and then use the first method to modify Oh.

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.