mysql ha innodb.so_Mysql 之 添加innodb支持-阿里云开发者社区

在对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 variables like "have_%";

+-------------------------+----------+

| Variable_name | Value |

+-------------------------+----------+

| have_community_features | YES |

| have_compress | YES |

| have_crypt | YES |

| have_csv | YES |

| have_dynamic_loading | YES |

| have_geometry | YES |

| have_innodb | NO |

| have_ndbcluster | NO |

| have_openssl | DISABLED |

| have_partitioning | NO |

| have_query_cache | YES |

| have_rtree_keys | YES |

| have_ssl | DISABLED |

| have_symlink | YES |

+-------------------------+----------+

14 rows in set (0.00 sec)

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 |

+------------+--------+----------------+---------+---------+

5 rows in set (0.01 sec)

#可见现在的mysql确实不支持innodb存储引擎

2.查看是否支持动态加载插件

mysql> show variables like "have_dynamic%";

+----------------------+-------+

| Variable_name | Value |

+----------------------+-------+

| have_dynamic_loading | YES |

+----------------------+-------+

1 row in set (0.00 sec)

#当现实为yes时表示支持动态加载mysql插件,该值一般为yes,当使用源码编译安装时不能使用–with-mysqld-ldflags=-all-static选项,以静态方式编译库,这样默认就会是yes。

3.放入插件文件

找到mysql存放插件的目录

mysql> show variables like 'plugin_dir';

+---------------+-----------------------------+

| Variable_name | Value |

+---------------+-----------------------------+

| plugin_dir | /opt/mysql/lib/mysql/plugin |

+---------------+-----------------------------+

1 row in set (0.00 sec)

#在该目录中查看是否已有ha_innodb.so和ha_innodb_plugin.so两个文件

[root@zhu2 mysql-5.1.39]# ll /opt/mysql/lib/mysql/plugin/ha_innodb.so

lrwxrwxrwx 1 mysql mysql 18 08-22 02:55 /opt/mysql/lib/mysql/plugin/ha_innodb.so -> ha_innodb.so.0.0.0

[root@zhu2 mysql-5.1.39]# ll /opt/mysql/lib/mysql/plugin/ha_innodb_plugin.so

lrwxrwxrwx 1 mysql mysql 25 08-22 02:55 /opt/mysql/lib/mysql/plugin/ha_innodb_plugin.so -> ha_innodb_plugin.so.0.0.0

#若没有可以去网上下载与所安装mysql对应的版本,或者直接去mysql源码包中storage/innobase/.libs/ha_innodb.so

storage/innodb_plugin/.libs/ha_innodb_plugin.so 复制到mysql的plugin目录中

4.添加动态安装加载

mysql> INSTALL PLUGIN InnoDB SONAME 'ha_innodb.so';

Query OK, 0 rows affected (0.61 sec)

5.查看现在是否支持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.重新编译安装 。。。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值