drupal7正式发布了,下载了一下,安装时候提示我错误,安装不了
Syntax error or access violation: 1286 Unknown table engine 'InnoDB'
原来是我的mysql里面,根本没有innodb存储引擎。进去后我们可以用 show engines;或者show plugins;来查看
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 | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | +------------+--------+----------------+---------+---------+ 5 rows in set (0.00 sec)
解决方法1(推荐使用):在configure的时候加上--with-plugins=innobase 如果要添多个插件,请用半角逗号隔开
如果何配置呢,其实将copy到/usr/local/mysql/my.cnf配置文件中[mysqld]下面有关innodb配置前面的#去掉就可以了。这是默认配置,可以根据个人需要进行修改
# 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
解决方法2:
如果你安装的时候忘记了添加innodb,又不想重新编辑mysql来添加,这样也没有关系,innodb就是一个插件,安装好mysql后也是可以添加的。
1,查看一下,mysql配置是不是支持动态添加插件
mysql> show variables like "have_%"; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | have_compress | YES | | have_crypt | YES | | have_csv | YES | | have_dynamic_loading | YES | //在这里是YES表示是支持的
如果是no呢,就不太好办,因为have_dynamic_loading是只读变量,
mysql> set have_dynamic_loading=1;
ERROR 1238 (HY000): Variable 'have_dynamic_loading' is a read only variable
不过一般情况下都是YES,
2,添加插件
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)
上面报没有权限错误,搞得我很郁闷,解决办法如下:
root@ubuntu:/usr/local/mysql# find . -type d -print |grep -i plugin //查看一下插件目录对不对 ./lib/mysql/plugin root@ubuntu:/usr/local/mysql# chcon -t texrel_shlib_t /usr/local/mysql/lib/mysql/plugin/ha_innodb.so chcon: 部分关联无法应用于文件“/usr/local/mysql/lib/mysql/plugin/ha_innodb.so”
用chcon也报错,我查一下是因为我没有安装selinux
root@ubuntu:/usr/local/mysql# whereis selinux
selinux:
selinux我根本没有安装,如果个人用,这个也不需要,没办法装一下,装完后chcon就不报错了。
安装以下几个
mysql> install plugin INNODB soname "ha_innodb.so"; mysql> install plugin INNODB_TRX soname "ha_innodb.so"; mysql> install plugin INNODB_LOCKS soname "ha_innodb.so"; mysql> install plugin INNODB_LOCK_WAITS soname "ha_innodb.so"; mysql> install plugin INNODB_CMP soname "ha_innodb.so"; mysql> install plugin INNODB_CMP_RESET soname "ha_innodb.so"; mysql> install plugin INNODB_CMPMEM soname "ha_innodb.so"; mysql> install plugin INNODB_CMPMEM_RESET soname "ha_innodb.so"
安装好后,在用 show engines;或者show plugins;来查看
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 | | InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL | | INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | | MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL | +---------------------+--------+--------------------+---------+---------+ 13 rows in set (0.00 sec)
配置和方法一一样,第二种方法比较麻烦,不推荐使用。
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/mysql/1202.html
默认的MySQL都是带有Innodb引擎的吧? 能否解释一下,innodb到底有啥用?
这个不一定的,根你下的mysql版本有关系,可能有的版本没有innodb。innodb也是一种存储引擎,但是功能更强大,对于读写都比较频繁的表比较适合。innodB提供了具有事务、回滚 和崩溃修复能力、多版本并发控制的事务安全型表。innodB 提供了行级锁等。
myisam如果是小的便利店的话,那么innodb就是大型超市,人越多,大型超市的优势越明显。