MySQL5.1: 安装启用InnoDB引擎

时间:2022-04-08 07:34:14

买的VPS服务器,CentOS6.3,一键安装的MySQL,版本5.1.61,默认引擎MyISAM,在phpmyadmin里面找不到InnoDB引擎。


自己安装启用InnoDB,InnoDB插件是随mysql软件包一起发布的,设置好加载路径即可。

编辑/etc/my.cnf文件,在[mysqld]下面添加如下内容:

ignore-builtin-innodbplugin-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 bytesInnoDB: 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     |+------------+--------+----------------+---------------------+---------+


参考链接:

http://dev.mysql.com/doc/innodb-plugin/1.0/en/innodb-plugin-installation-dynamic.html


by iefreer