今天作测试时,查看错误日志发现有报错html
2014-02-08 09:55:33 16545 [Warning] InnoDB: Cannot open table bit/inside_log from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem. 2014-02-08 09:55:33 16545 [ERROR] Failed to open table bit/inside_parameters#P#p201311. 2014-02-08 09:55:33 16545 [Warning] InnoDB: Cannot open table bit/inside_parameters#P#p201311 from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem. 2014-02-08 09:55:33 b6cc0b70 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
缘由是:innodb在.frm中存放了表的信息,可是同时也在数据字典中存放有表信息mysql
此时多是直接操做了数据文件而数据字典没来得及更新服务器便挂掉了致使不一致sql
drop table inside_parameters;shell
更新数据字典,同时会自动删除数据文件bash
2014-02-08 10:05:56 16545 [Warning] InnoDB: Cannot open table bit/inside_parameters#P#p201311 from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem. 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: table `bit`.`inside_parameters` /* Partition `p201311` */ does not exist in the InnoDB internal InnoDB: data dictionary though MySQL is trying to drop it. InnoDB: Have you copied the .frm file of the table to the InnoDB: MySQL database directory from another database? InnoDB: You can look for further help from InnoDB: http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: table `bit`.`inside_parameters` /* Partition `p201312` */ does not exist in the InnoDB internal InnoDB: data dictionary though MySQL is trying to drop it. InnoDB: Have you copied the .frm file of the table to the InnoDB: MySQL database directory from another database? InnoDB: You can look for further help from InnoDB: http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: table `bit`.`inside_parameters` /* Partition `p201401` */ does not exist in the InnoDB internal InnoDB: data dictionary though MySQL is trying to drop it. InnoDB: Have you copied the .frm file of the table to the InnoDB: MySQL database directory from another database? InnoDB: You can look for further help from InnoDB: http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 2014-02-08 10:06:05 b6cc0b70 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
此时一直提示innodb_table_stats表不存在
服务器
查阅官方文档以后发现是5.6的新特性
ide
在MySQL 5.6以前,若是关闭MySQL后删除ibdata1,再从新启动MySQL的时候ibdata1会被从新建立. 但从MySQL 5.6开始,这5个表不会被重建.即便删除了ibdata1,下面的10个文件仍然保留在/var/lib/mysql/mysql中(假如datadir = /var/lib/mysql/):测试
innodb_index_stats.frm
innodb_index_stats.ibd
innodb_table_stats.frm
innodb_table_stats.ibd
slave_master_info.frm
slave_master_info.ibd
slave_relay_log_info.frm
slave_relay_log_info.ibd
slave_worker_info.frm
slave_worker_info.ibdspa
在安装MySQL 5.6,使用mysql_install_db作初始化的时候须要指定–defaults-file选项,按照自定义的my.cnf里面的参数去初始化,而不能采用和5.5同样的方法删除以前的ibdata1文件后再从新生成新,由于MySQL 5.6在mysql系统库下引入上述的5个innodb表。不然启动mysqld的时候会出现我以前的警告信息日志
解决办法,重新库中导出这5个表再导入到现有库中
#!/bin/bash TABLELIST="innodb_index_stats" TABLELIST="${TABLELIST} innodb_table_stats" TABLELIST="${TABLELIST} slave_master_info" TABLELIST="${TABLELIST} slave_relay_log_info" TABLELIST="${TABLELIST} slave_worker_info" mysqldump -uroot -p mysql ${TABLELIST} > mysql_innodb_tables.sql 将文件拷贝回现有库 # mysql -uroot -p mysql < mysql_innodb_tables.sql
OK!