1. 程式人生 > >MySQL5.1: 安裝啟用InnoDB引擎

MySQL5.1: 安裝啟用InnoDB引擎

買的VPS伺服器,CentOS6.3,一鍵安裝的MySQL,版本5.1.61,預設引擎MyISAM,在phpmyadmin裡面找不到InnoDB引擎。

自己安裝啟用InnoDB,InnoDB外掛是隨mysql軟體包一起釋出的,設定好載入路徑即可。

編輯/etc/my.cnf檔案,在[mysqld]下面新增如下內容:

ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so
plugin_dir=/usr/local/mysql-5.1.61/lib/mysql/plugin

重啟mysql服務:

/etc/init.d/mysqld restart

進入mysql命令列,執行show plugins或者show engines命令,

如果發現InnoDB沒有被載入,那麼請檢查mysql錯誤日誌(由log-error進行配置),比如:

tail -f /usr/local/mysql-5.1.61/var/my.err

出現錯誤資訊:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
140207 20:29:25 [ERROR] Plugin 'InnoDB' init function returned error.
140207 20:29:25 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

原因是在my.cnf裡面更改了innodb_log_file_size變數的數值,如無必要修改,去掉重啟:
mysql> show plugins;
+------------+--------+----------------+---------------------+---------+
| Name       | Status | Type           | Library             | License |
+------------+--------+----------------+---------------------+---------+
| binlog     | ACTIVE | STORAGE ENGINE | NULL                | GPL     |
| CSV        | ACTIVE | STORAGE ENGINE | NULL                | GPL     |
| MEMORY     | ACTIVE | STORAGE ENGINE | NULL                | GPL     |
| MyISAM     | ACTIVE | STORAGE ENGINE | NULL                | GPL     |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL                | GPL     |
| InnoDB     | ACTIVE | STORAGE ENGINE | ha_innodb_plugin.so | GPL     |
+------------+--------+----------------+---------------------+---------+

參考連結:

by iefreer