在 MySQL 5.1 之後預設不支援 InnoDB,如果你要開啟支援 InnoDB 可以用編譯或是動態加載的方式載入 InnoDB plugin
查看是否支援 InnoDB
$ mysql -uroot -p mysql> show engines \g; Engine: InnoDB Support: YES Comment: Supports transactions, row-level locking, and foreign keys Transactions: YES XA: YES Savepoints: YES
如果找不到 InnoDB 的項目,就進行加載 InnoDB
MySQL 編譯 with InnoDB
$ ./configure --prefix=/usr/local/mysql51 --with-extra-charsets=all --with-plugins=innobase
MySQL 動態加載 with InnoDB
確認是否支援動態加載
mysql> show variables like "have_dynamic%" \G; Variable_name: have_dynamic_loading Value: YES
have_dynamic_loading = Yes 表示可以進行加載
mysql> INSTALL PLUGIN InnoDB SONAME 'ha_innodb_plugin.so';
如果加載失敗,或是找不到 ha_innodb_plugin.so,可以到 mysql plugin 路徑下尋找是否缺少檔案
mysql> SHOW VARIABLES LIKE '%plugin%'; Variable_name: plugin_dir Value: /usr/lib64/mysql/plugin