MySQL中預設啟用了INNODB嗎?
是的,從 MySQL 版本 4.0 開始,預設啟用了它。在此,我們使用 MySQL 版本 8.0.1 −
mysql> select version(); +-----------+ | version() | +-----------+ | 8.0.12 | +-----------+ 1 row in set (0.00 sec)
現在,讓我們檢查 my.ini,其中可以看到預設引擎型別 InnoDB −

我們首先建立兩個表。其中一個將使用引擎型別進行設定,而另一個將不會使用引擎型別進行設定。
第一個表 −
mysql> create table DemoTable1(Id int NOT NULL AUTO_INCREMENT PRIMARY KEY); Query OK, 0 rows affected (0.80 sec)
第二個表使用 ENGINE InnoDB 設定 −
mysql> create table DemoTable2( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY ) ENGINE=InnoDB; Query OK, 0 rows affected (0.76 sec)
無論你是否提到了引擎型別,上面兩個表都具有引擎型別 InnoDB。
讓我們檢查第一個表的引擎型別 −
mysql> select engine from information_schema.TABLES where TABLE_SCHEMA = 'web' and table_name='DemoTable1'; +--------+ | ENGINE | +--------+ | InnoDB | +--------+ 1 row in set (0.56 sec)
現在,讓我們檢查第二個表的引擎型別 −
mysql> select engine from information_schema.TABLES where TABLE_SCHEMA = 'web' and table_name='DemoTable2'; +--------+ | ENGINE | +--------+ | InnoDB | +--------+ 1 row in set (0.00 sec)
正如你可以看到的,上面兩個表都顯示引擎型別為“InnoDB”。即使我們沒有在 DemoTable1 中提到引擎型別,可見的引擎型別仍然是“InnoDB”。
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP