MySQL database various search engines

First, what is the storage engine

MySQL data in a variety of different technologies stored in the file (or memory) in the. Each of these technologies technology uses a different storage mechanism, indexing techniques, lock level and ultimately provide a wide range of different functions and capabilities. These different technologies and supporting the associated function is called in MySQL storage engine (also called table type). That is what way to store data, each way is a kind of table type.

Two, mysql storage engine category

Main storage engine: 1. MyIsam, 2. Mrg_Myisam, 3. Memory, 4. Blackhole, 5. CSV, 6. Performance_Schema, 7. Federated, 8.InnoDB
in mysql, the following command can see the engine MySQL support.

show engines;
mysql> show engines\G;
*************************** 1. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 3. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 5. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 6. row ***************************
Engine: FEDERATED
Support: NO
Comment: Federated MySQL storage engine
Transactions: NULL
XA: NULL
Savepoints: NULL
*************************** 7. row ******************** *******
Engine: PERFORMANCE_SCHEMA
Support: YES
the Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
************************ 8. Row *************************** ***
Engine: the MEMORY
Support: YES
the Comment: Hash based, the Stored in Memory, Useful for the Tables the Temporary
Transactions: NO
XA: NO
Savepoints: NO
specific description with reference to the mysql storage engine introduced in this article.

3. If the selected database engine change

Method one:
modify the configuration file my.cnf, add [mysqld] behind the default-storage-engine = InnoDB, restart the service, the default database engine modified to InnoDB
two methods:
specify when construction of the table:

 Create Table: CREATE TABLE `student` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
 `name` char(15) NOT NULL,
`age` tinyint(2) NOT NULL DEFAULT '0',
`dept` varchar(16) DEFAULT NULL,
`sex` char(2) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `index_dept` (`dept`(8))
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
#指定 ENGINE=InnoDB

Method three:
After the construction of the table changes

alter table table_name ENGINE = InnoDB;
example:

alter table student ENGINE=InnoDB;

Fourth, how to view what engine

Method a:
Show Status Table from database_name;
example:

show table status from data_default\G;
show table status from mysql\G;

Method two:
Show Create Table table_name
example:

 show create table student\G;
 show create table mysql.time_zone_transition_type\G;

Guess you like

Origin blog.csdn.net/weixin_44596822/article/details/94122644