1.alter table
it can take a lot of time.MySQL will perform a row-by-row copy of your old table into a new table. During that
time, you’ll probably be using all of the server’s disk I/O capacity, and the original table will be read-locked while the conversion runs
When you convert from one storage engine to another, any storage engine–specific features are lost
2.dump and import
(1)first dump the table to a text file using the mysqldump utility
(2)adjust the CREATE TABLE statement it contains
mysqldump defaults to writing a DROP TABLE command before the CREATE TABLE -- 特别注意
3 create and select
mysql> CREATE TABLE innodb_table LIKE myisam_table;
mysql> ALTER TABLE innodb_table ENGINE=InnoDB;
mysql> INSERT INTO innodb_table SELECT * FROM myisam_table;
percona的pt_online_schema_change工具实现了上述操作的功能;
start transaction;
INSERT INTO innodb_table SELECT * FROM myisam_table where id between x and y;
commit;
阅读(755) | 评论(0) | 转发(0) |