显示数据库支持的存储引擎和默认存储引擎。实例:
mysql> show storage engines; +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO | | MyISAM | YES | MyISAM storage engine | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | ARCHIVE | YES | Archive storage engine | NO | NO | NO | | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO | | FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ 9 rows in set (0.00 sec)
也可以忽略 storage,直接使用 show engines。
显示存储引擎的详细信息。实例:使用 status 选项查看引擎的状态。如下:
mysql> show engine InnoDB status \G *************************** 1. row *************************** Type: InnoDB Name: Status: ===================================== 2020-03-13 11:23:28 0x1700 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 15 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 600 srv_active, 0 srv_shutdown, 96511 srv_idle srv_master_thread log flush and writes: 97109 ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 1970 OS WAIT ARRAY INFO: signal count 1869 RW-shared spins 0, rounds 2406, OS waits 1191 RW-excl spins 0, rounds 333, OS waits 0 RW-sx spins 0, rounds 0, OS waits 0 Spin rounds per wait: 2406.00 RW-shared, 333.00 RW-excl, 0.00 RW-sx ...
上面使用 \G 格式化输出。
使用 mutex 查看存储引擎的互斥量。实例:
mysql> show engine InnoDB mutex; +--------+-----------------------------+------------+ | Type | Name | Status | +--------+-----------------------------+------------+ | InnoDB | rwlock: dict0dict.cc:1184 | waits=82 | | InnoDB | rwlock: log0log.cc:844 | waits=1058 | | InnoDB | sum rwlock: buf0buf.cc:1457 | waits=51 | +--------+-----------------------------+------------+ 3 rows in set (0.00 sec)