在对mysql进行编译安装时,当安装完成后有时会发现不支持innodb存储引擎,这是因为编译安装时缺少支持innodb的参数:
--with-plugins=PLUGIN[,PLUGIN..]
Plugins to include in mysqld. (default is: none)
Must be a configuration name or a comma separated
list of plugins.
Available configurations are: none max max-no-ndb all.
Available plugins are: partition archive blackhole
csv example federated heap ibmdb2i innobase
innodb_plugin myisam myisammrg ndbcluster.
--with-plugins=innobase 或者--with-plugins=all #这是在5.5版本前
-DWITH_INNOBASE_STORAGE_ENGINE=1 #这是在5.5以后版本,用cmake编译时支持innodb所用的参数
然而,那些参数都是在编译时应选的,对现在的问题也于事无补;下面介绍如何添加innodb支持。
一.动态加载innodb
查看现在mysql到底是否支持innodb
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.so | GPL |
+------------+--------+----------------+--------------+---------+
6 rows in set (0.01 sec)
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)
二:追加编译
1.删除innodb支持,并查看
mysql> UNINSTALL PLUGIN innodb;
Query OK, 0 rows affected (0.52 sec)
mysql> show engines;
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| 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 |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
4 rows in set (0.00 sec)
2.重新编译安装