This article describes how to change the mysql engine (InnoDB, MyISAM). The example describes several common methods to change the engine, which is of great practical value, for more information about how to change the mysql engine (InnoDB, MyISAM. The specific implementation method is as follows:
The default mysql database engine is MyISAM, which does not support transactions and foreign keys. you can also use InnoDB that supports transactions and foreign keys.
View the supported database engines and default database engines of the current database
Database-supported engines and default database engine code:
The code is as follows:
Show engines;
Method 1:Modify the configuration file my. ini
I save the my-small.ini as my. ini, add it on [mysqld], default-storage-engine = InnoDB, restart the service, and change the default engine of the database to InnoDB
Method 2:Specify or modify the table when creating the table
Mysql code:
-- Specify
The code is as follows:
Create table mytbl (
Id int primary key,
Name varchar (50)
) Type = MyISAM;
-- Modify the table after the table is created
The code is as follows:
Alter table mytbl2 type = InnoDB;
-- View the modification result (mytest is the name of the database where the table is located)
The code is as follows:
Show table status from mytest;
-- Or use
The code is as follows:
Show create table table_name
I hope this article will help you design MySQL database programs.