Mysql Change Engine (Innodb,myisam) method _mysql

Source: Internet
Author: User
Tags mysql code

This article describes the MySQL Change engine (Innodb,myisam) method, share for everyone to reference. The implementation methods are as follows:

The MySQL default database engine is MyISAM, does not support transactions and foreign keys, and can also use InnoDB that support transactions and foreign keys.

View the supported database engine for the current database and the default database engine

Database-supported engine and default database engine code:

Copy Code code as follows:
Show engines;

Change Mode 1: Modify configuration file My.ini

I save the My-small.ini as a my.ini, at the end of [mysqld] add as upper Default-storage-engine=innodb, restart the service, and the database default engine is modified to InnoDB

Change Mode 2: specify or complete a table modification when building a table

MySQL Code:
--Specify when building the table

Copy Code code as follows:
CREATE TABLE Mytbl (
ID int PRIMARY KEY,
Name varchar (50)
) Type=myisam;

--Modified after the table is completed
Copy Code code as follows:
ALTER TABLE MYTBL2 type = InnoDB;

--View the modified result (MyTest is the database name of the table)
Copy Code code as follows:
Show table status from MyTest;

-or use
Copy Code code as follows:
Show CREATE TABLE table_name

I hope this article is helpful to the design of MySQL database.

Related Article

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.