Home >Database >Mysql Tutorial >How to convert MyISAM storage engine in MySQL to InnoDB storage engine?
To convert the MyISAM engine to InnoDB, we can use the ALTER command. Now let us create a table with the help of engine MyISAM.
mysql> create table MyISAMToInnoDBDemo -> ( -> id int, -> Name varchar(100) -> )ENGINE=MyISAM; Query OK, 0 rows affected (0.19 sec)
Check whether the table was created using the MyISAM engine.
mysql> SELECT TABLE_NAME,ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'business' and ENGINE = 'MyISAM';
The following is the output of a table created using the MyISAM engine.
+-------------------------+--------+ | TABLE_NAME | ENGINE | +-------------------------+--------+ | studentrecordwithmyisam | MyISAM | +-------------------------+--------+ 1 row in set (0.00 sec)
We can convert MyISAM to InnoDB with the help of the ALTER command.
mysql> alter table MyISAMToInnoDBDemo engine=InnoDB; Query OK, 0 rows affected (1.65 sec) Records: 0 Duplicates: 0 Warnings: 0
Check conversion.
mysql> SELECT TABLE_NAME,ENGINE FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test' and ENGINE = 'InnoDB';
This is the output.
+--------------------+--------+ | TABLE_NAME | ENGINE | +--------------------+--------+ | myisamtoinnodbdemo | InnoDB | +--------------------+--------+ 1 row in set (0.00 sec)
The above is the detailed content of How to convert MyISAM storage engine in MySQL to InnoDB storage engine?. For more information, please follow other related articles on the PHP Chinese website!