欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

关于mysql的Unknown table engine ‘InnoDB’与安装 mysql innod

程序员文章站 2022-06-02 16:02:21
...

在创建测试分页表时,出现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,

在创建测试分页表时,出现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/