MySQL是當前企業級應用中使用最廣泛的關系型數據庫系統之一。在使用MySQL的過程中,我們經常會遇到需要判斷數據庫引擎是不是InnoDB引擎的情況。下面我們介紹一下如何通過MySQL的命令行界面來判斷數據庫引擎是否為InnoDB。
mysql>SHOW 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)
如上代碼所示,在MySQL的命令行界面輸入“SHOW ENGINES;”命令可查看當前MySQL數據庫支持的所有引擎。其中,在InnoDB引擎那一行的“Support”列中,如果顯示為“DEFAULT”,就表明當前數據庫的默認存儲引擎為InnoDB,也就是說當前使用的引擎就是InnoDB。
使用以上方法可以非常方便地判斷MySQL數據庫的默認引擎是否為InnoDB,如果當前使用的不是InnoDB,可以通過修改my.cnf文件來更改默認存儲引擎類型。