12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-03 12:14:19
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
最近在巡检的时候,发现mysql错误日志中,报如下错误:
1779986 2015-10-06 00:06:37 7f5215214700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.1779987 2015
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
1779986 2015-10-06 00:06:37 7f5215214700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.1779987 2015-10-06 00:06:37 7f5215214700 InnoDB: Recalculation of persistent statistics requested for table "xxxx"."xxxxxx" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.经过排查,发现是mysql 的几张系统表不见了,到底是那几张呢?MySQL 5.6的ibdata1表空间包含了5个InnoDB基础表,如下:
mysql> select table_name from information_schema.tables where table_schema='mysql' and engine='InnoDB';+----------------------+| table_name |+----------------------+| innodb_index_stats || innodb_table_stats || slave_master_info|| slave_relay_log_info || slave_worker_info|+----------------------+5 rows in set (0.00 sec)在MySQL 5.6之前,如果关闭MySQL后删除ibdata1,再重新启动MySQL的时候ibdata1会被重新创建, 但从MySQL 5.6开始,这5个表不会被重建,究其缘由是因为这几张表的存储引擎是innodb,而且在MySQL5.5 中并没有这几张表。大致来看看5.6与5.5系统表的区别:
MySQL 5.5 系统表 +---------------------------+| columns_priv || db || event || func || help_category || help_keyword || help_relation || help_topic || host || ndb_binlog_index || plugin || proc || procs_priv || proxies_priv || servers || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+22 rows in set (0.00 sec)
MySQL 5.6 系统表+---------------------------+| Tables_in_mysql |+---------------------------+| columns_priv || db || event || func || general_log | | help_category || help_keyword || help_relation || help_topic || innodb_index_stats || innodb_table_stats || ndb_binlog_index || plugin || proc || procs_priv || proxies_priv || servers || slave_master_info || slave_relay_log_info || slave_worker_info || slow_log || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+28 rows in set (0.00 sec)由上述统计可以看到,在mysql5.6 中,除了增加了上述5张表,还添加了general_log 、slow_log 表,并且将5.5中的host表合到了5.6中的user表中。
#!/bin/shTABLELIST="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_innodb_tables.sql拷贝到出现坏表错误的那台数据库机器,并将其导入到系统库mysql库中.
# mysql -uroot -p mysql < mysql_innodb_tables.sql运行FLUSH TABLES(可选) 5、重启数据库6、启动slave,如果报错,重新change master7、重新确定错误日志中有无类似报错
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19