关于mysql的Unknown table engine ‘InnoDB’与安装 mysql innodb 插件

在创建测试分页表时,出现warnings,奇怪创建表怎么还出现warnings信息呢
mysql> create table test_fenye (uid bigint not null  auto_increment, username varchar(30), primary key(uid) ) engine=innodb  default charset=utf8;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
查看warnings信息
mysql> show warnings;
+———+——+—————————————————-+
| Level   | Code | Message                                            |
+———+——+—————————————————-+
| Warning | 1286 | Unknown table engine ‘innodb’                      |
| Warning | 1266 | Using storage engine MyISAM for table ‘test_fenye’ |
+———+——+—————————————————-+
2 rows in set (0.00 sec)

奇怪,怎么会Unknown table engine ‘innodb?查询资料,原来MySQL自5.1.*之后,InnoDB就已经不再内置,作为插件来安装了。下面进行InnoDB插件安装与配置

MySQL InnoDB插件安装与配置
如果你安装的时候忘记了添加innodb,又不想重新编辑mysql来添加,这样也没有关系,innodb就是一个插件,安装好mysql后也是可以添加的。

1.先查看MySQL是否安装了innodb插件

mysql> show plugin;
+————+——–+—————-+———+———+
| 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     |
+————+——–+—————-+———+———+
2.安装InnoDB插件

mysql> install plugin innodb soname ‘ha_innodb.so’;
如果出现类似错误: ERROR 1126 (HY000): Can’t open shared library ‘/usr/local/mysql/lib/mysql/plugin/ha_innodb.so’ (errno: 13 cannot restore segment prot after reloc: Permission denied)
解决办法: chcon -t texrel_shlib_t /usr/local/mysql/lib/mysql/plugin/ha_innodb.so

3.修改MySQL配置文件/etc/my.cnf
# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/mysql/var/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/mysql/var/
# You can set .._buffer_pool_size up to 50 – 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

4.重启MySQL数据库

如果你想卸载innodb插件,你直接执行
uninstall plugin innodb;


http://www.dbfans.net/%25postname%25.html/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值