存储引擎:
查看支持的存储引擎
SHOW ENGINES;
或者
SHOW ENGINES \G
mysql> show master status\G
*************************** 1. row ***************************
File: XTZJ-2021XXASFT-bin.000012
Position: 157
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
mysql> show engines \G
*************************** 1. row ***************************
Engine: MEMORY
Support: YES
Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 2. row ***************************
Engine: MRG_MYISAM
Support: YES
Comment: Collection of identical MyISAM tables
Transactions: NO
XA: NO
Savepoints: NO
*************************** 3. row ***************************
Engine: CSV
Support: YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 4. row ***************************
Engine: FEDERATED
Support: NO
Comment: Federated MySQL storage engine
Transactions: NULL
XA: NULL
Savepoints: NULL
*************************** 5. row ***************************
Engine: PERFORMANCE_SCHEMA
Support: YES
Comment: Performance Schema
Transactions: NO
XA: NO
Savepoints: NO
*************************** 6. row ***************************
Engine: MyISAM
Support: YES
Comment: MyISAM storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 7. row ***************************
Engine: InnoDB
Support: DEFAULT
Comment: Supports transactions, row-level locking, and foreign keys
Transactions: YES
XA: YES
Savepoints: YES
*************************** 8. row ***************************
Engine: ndbinfo
Support: NO
Comment: MySQL Cluster system information storage engine
Transactions: NULL
XA: NULL
Savepoints: NULL
*************************** 9. row ***************************
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints: NO
*************************** 10. row ***************************
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
*************************** 11. row ***************************
Engine: ndbcluster
Support: NO
Comment: Clustered, fault-tolerant tables
Transactions: NULL
XA: NULL
Savepoints: NULL
11 rows in set (0.05 sec)
Engine 表示存储引擎名称
Supoort MySQL数据库管理系统是否支持该存储引擎,YES表示支持,NO表示不支持,DEFAULT表示系统默认支持的存储引擎
Comment参数表示对存储引擎的评论
Transactions参数表示存储引擎是否支持事务,其中YES表示支持,NO表示不支持
XA参数表示存储引擎所支持的分布式是否符合XA规范,其中YES表示支持,NO表示不支持
Savepoints参数表示存储引擎是否支持事务处理的保存点,其中YES表示支持,NO表示不支持
还可以通过 SHOW VARIABLES 命令查看所支持的存储引擎:
mysql> SHOW VARIABLES LIKE 'have%';
+------------------------+----------+
| Variable_name | Value |
+------------------------+----------+
| have_compress | YES |
| have_dynamic_loading | YES |
| have_geometry | YES |
| have_openssl | YES |
| have_profiling | YES |
| have_query_cache | NO |
| have_rtree_keys | YES |
| have_ssl | YES |
| have_statement_timeout | YES |
| have_symlink | DISABLED |
+------------------------+----------+
10 rows in set, 1 warning (0.22 sec)
如果在创建表时,没有指定存储引擎,表的存储引擎为默认的引擎,查看默认引擎:
mysql> SHOW VARIABLES LIKE 'default_storage_engine';
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+
1 row in set, 1 warning (0.00 sec)
Value 表示MySQL数据库管理系统是否支持存储引擎 yes表示支持 no表示不支持 DISABLED表示支持但未开启
修改mysql默认的存储引擎,my.cnf 或 my.ini 配置
先关闭mysql服务
找到
default-storage-engine=MyISAM
修改后保存文件,重启MySQL服务
或者
使用sql语句修改默认存储引擎
SET DEFAULT_STORAGE_ENGINE=MyISAM
SHOW VARIABLES LIKE '%storage_engine%';