Mysql change engine (InnoDB, MyISAM) method_mysql

Source: Internet
Author: User
Tags mysql code
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.

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.