在做实验时,使用mysqldump命令报错

[root@linux-mysql02 3306]# mysqldump -uroot -p123456 -S /u02/data/3306/mysql.sock -A -B --events | gzip > /opt/rep.sql.gz

mysqldump: Got error: 1146: Table 'mysql.innodb_index_stats' doesn't exist when using LOCK TABLES

然后查看错误日志:

[root@linux-mysql02 ~]# vim /u02/data/3306/mysql_oldboy3306.err

2017-08-09 15:21:10 19726 [Warning] InnoDB: Cannot open table mysql/innodb_index_stats 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.

[root@linux-mysql02 ~]# mysql -uroot -p123456 -S /u02/data/3306/mysql.sock

mysql> use mysql

mysql> show tables;

mysql> show create table slave_master_info\G

ERROR 1146 (42S02): Table 'mysql.slave_master_info' doesn't exist

最后测试发现以下几个系统表不存在.
innodb_table_stats
innodb_index_stats
slave_master_info
slave_relay_log_info
slave_worker_info

这是因为数据库初始化的时候,dba可能删除过ibdata1文件
虽然重启之后,数据库会自动创建一个ibdata1文件,但是上述系统表也是innodb引擎,所以不能访问了.
这虽然不会影响业务,但是使用innobackupex备份的时候,会写入错误日志.
最后错误日志里,都是这种信息.影响日常检查。

解决的方法.
1.删除上述系统表
drop table mysql.innodb_index_stats;
drop table mysql.innodb_table_stats;
drop table mysql.slave_master_info;
drop table mysql.slave_relay_log_info;
drop table mysql.slave_worker_info;

2.删除相关的.frm .ibd文件
rm -f innodb_index_stats*
rm -f innodb_table_stats*
rm -f slave_master_info*
rm -f slave_relay_log_info*
rm -f slave_worker_info*

3.重新创建上述系统表
CREATE TABLE `innodb_index_stats` (
  `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `index_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `stat_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `stat_value` bigint(20) unsigned NOT NULL,
  `sample_size` bigint(20) unsigned DEFAULT NULL,
  `stat_description` varchar(1024) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`,`index_name`,`stat_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;

CREATE TABLE `innodb_table_stats` (
  `database_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `table_name` varchar(64) COLLATE utf8_bin NOT NULL,
  `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `n_rows` bigint(20) unsigned NOT NULL,
  `clustered_index_size` bigint(20) unsigned NOT NULL,
  `sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0;

CREATE TABLE `slave_master_info` (
  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
  `Host` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'The host name of the master.',
  `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
  `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
  `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
  `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
  `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
  `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
  `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
  `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
  `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
  `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
  `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
  `Heartbeat` float NOT NULL,
  `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
  `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
  `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
  `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
  `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
  `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
  `Enabled_auto_position` tinyint(1) NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.',
  PRIMARY KEY (`Host`,`Port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Master Information';

CREATE TABLE `slave_relay_log_info` (
  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
  `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
  `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
  `Number_of_workers` int(10) unsigned NOT NULL,
  `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information';

CREATE TABLE `slave_worker_info` (
  `Id` int(10) unsigned NOT NULL,
  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Relay_log_pos` bigint(20) unsigned NOT NULL,
  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Master_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
  `Checkpoint_seqno` int(10) unsigned NOT NULL,
  `Checkpoint_group_size` int(10) unsigned NOT NULL,
  `Checkpoint_group_bitmap` blob NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information';

4.如果是Slave备机,停止复制,记录pos等信息
mysql> stop slave;
Query OK, 0 rows affected (0.09 sec)

5.重启数据库

6.如果Slave启动报错,则使用步骤4的信息,重新change master

再删除ibdata1文件的时候,一定要想起系统数据库还有5张innodb表...

转载于:https://blog.51cto.com/10742668/1957314

MySQL innodb_table_stats表不存在的解决方法相关推荐

  1. mysql 提示表不存在的解决方法error 1146 Table doesn't exist

    直接拷贝数据库导致提示表不存在的解决方法 电脑重装系统后把原来的mysql data复制进去后大部分表是可以访问的,但是有几个表提示表不存在: error: 1146: Table 'your_tab ...

  2. MySQL之——安装 mysql.slave_master_info表不存在的解决方法

    转载请注明出处:https://blog.csdn.net/l1028386804/article/details/92677790 1.在安装mysql 5.6.15时,安装完成后,后台日志报如下警 ...

  3. Mysql 数据库锁表的原因和解决方法

    Mysql 数据库锁表的原因和解决方法 参考文章: (1)Mysql 数据库锁表的原因和解决方法 (2)https://www.cnblogs.com/xinruyi/p/11108795.html ...

  4. mysql库的user表误删除或mysql的管理员密码丢失的解决方法

    mysql库的user表误删除或mysql的管理员密码丢失的解决方法 参考文章: (1)mysql库的user表误删除或mysql的管理员密码丢失的解决方法 (2)https://www.cnblog ...

  5. dede修改mysql,Dedecms(织梦)程序MySQL修复表和文章路径修改方法

    做网站是我们经常会遇到被一些小问题困扰的.其实有些问题非常的简单,通过百度搜索一下都是可以解决的. 最近模板网遇到两个用户的dedecms的问题,一个涉及到MySQL修复表,另一个就是文章路径修改,相 ...

  6. mysql 启动服务1067_windows无法启动MySQL服务报错1067的解决方法

    突然登陆MySQL时,出现禁止访问或者无法连接到数据库,回到服务,去打开wampmysqld ,发现 "windows无法启动MySQL服务 错误1067" ,死活启动不了,咋办? ...

  7. mysql errno 1146_Mysql学习MySQL复制出错 Last_SQL_Errno:1146的解决方法

    <MysqL学习MysqL复制出错 Last_sql_Errno:1146的解决方法>要点: 本文介绍了MysqL学习MysqL复制出错 Last_sql_Errno:1146的解决方法, ...

  8. mysql table plugin,MySql报错Table mysql.plugin doesn’t exist的解决方法

    MySql报错Table mysql.plugin doesn't exist的解决方法 一般产生原因是手工更改my.ini的数据库文件存放地址导致的 mysql服务启动时候找不到内置数据库" ...

  9. 非法关机 mysql_一次非法关机导致mysql数据表损坏的实例解决 -电脑资料

    排查修复数据表的经过: 2.启动mysql服务,卸载和关闭rpm安装的mysql服务 (昨天安装postfix好像yum安装了mysql),用netstat -anp |grep mysqld 命令查 ...

最新文章

  1. Django View(视图系统)
  2. android app系统的测试_计算机毕设项目003之基于Android系统的App点餐外送系统
  3. boost::log::sources::severity_logger用法的测试程序
  4. NSubstitute完全手册索引
  5. CF1067E Random Forest Rank(树形dp,概率与期望,线性代数)
  6. DWR整合Spring
  7. AndroidDeveloper Weekly NO.4
  8. QQ服务器维护一般多久,QQ扩列怎么暂停服务了维护到什么时候结束
  9. Hbase API学习
  10. c++ 向量化_一种新的FIR滤波器系数量化方法
  11. 老司机带你飞——DIY桌面小电视
  12. 前端工程师的三种级别,技术决定你能拿5K,还是15K,还是25K
  13. mysql 主主1032_mysql 主从复制 1032
  14. 白嫖银行?普通人为数不多的机会
  15. 《爱乐之城》配色分享
  16. 某数4代cookie生成-2
  17. 2020 多校联盟(第一场)
  18. 动软代码生成器 第一次使用出现附加数据库错误是否添加写入权限
  19. PS 模糊|锐化|涂抹工具
  20. 直播预告|脑机接口学术周来袭,2023世界机器人大赛赛题解读、学术分享抢先看!

热门文章

  1. java 对象序列化 数组_序列化-将任何对象转换为j中的字节数组
  2. 百度java的线程技术_自我提升(基础技术篇)——java线程简介
  3. leetcode1299. 将每个元素替换为右侧最大元素
  4. leetcode117. 填充每个节点的下一个右侧节点指针 II
  5. js 用下标获取map值_js map方法处理返回数据,获取指定数据简写方法
  6. python求小于n的所有素数_用python求出2000000内所有素数的和?不知怎么写?
  7. 王道考研 计算机网络6 OSI参考模型和各层作用
  8. 计算机系统基础 计算机系统的基本组成与基本功能
  9. 3个观念 不再瞎学习!
  10. 专访刘伟:软件开发人员的内功修炼之道