执行mysqldump备份数据时报错

环境;
MySQL 版本 5.6.28

问题:
执行mysqldump出现以下报错,小白当时执行mysqldump备份时,是执行一次报一个错
1、mysqldump: Got error: 1146: Table 'mysql.innodb_index_stats' doesn't exist when using LOCK TABLES
2、mysqldump: Got error: 1146: Table 'mysql.innodb_table_stats' doesn't exist when using LOCK TABLES
3、mysqldump: Got error: 1146: Table 'mysql.slave_master_info' doesn't exist when using LOCK TABLES
4、mysqldump: Got error: 1146: Table 'mysql.slave_relay_log_info' doesn't exist when using LOCK TABLES
5、mysqldump: Got error: 1146: Table 'mysql.slave_worker_info' doesn't exist when using LOCK TABLES

解决方式:
1、删除上述系统表,
mysql> drop table mysql.innodb_index_stats;
mysql> drop table mysql.innodb_table_stats;
mysql> drop table mysql.slave_master_info;
mysql> drop table mysql.slave_relay_log_info;
mysql> drop table mysql.slave_worker_info;
可能报如下错误:
mysql> drop table mysql.innodb_index_stats;
ERROR 1051 (42S02): Unknown table 'mysql.innodb_index_stats'
这时使用下面2的删除方式

2、删除数据库mysql下相关的.frm .ibd文件,重启数据库
[[email protected] mysql]# rm -rf innodb_index_stats.*
[[email protected] mysql]# rm -rf innodb_table_stats.*
[[email protected] mysql]# rm -rf slave_master_info.*
[[email protected] mysql]# rm -rf slave_relay_log_info*
[[email protected] mysql]# rm -rf slave_worker_info*
[[email protected] mysql]# systemctl restart mysqld

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、如果数据库有master-slave主备架构,恢复上诉表后,Slave启动报错,解决方法请百度
......

原文地址:http://blog.51cto.com/3332935/2141635

时间: 2024-08-29 18:20:08

执行mysqldump备份数据时报错的相关文章

ORA-01843的错误 插入日期数据时报错

当我在SQLPLUS执行 : INSERT INTO customers ( customer_id, first_name, last_name, dob, phone ) VALUES ( 5, 'Doreen', 'Blue', '20-MAY-1970', NULL ); 出现 "ORA-01843: 无效的月份 "这个错误. Google之后找到下面的这篇文章,其中说先执行alter session set nls_date_language='american'  然后再执

(转)svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrupted”

今天碰到了个郁闷的问题,svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrupted”.无论你到那个父层次的目录执行“clean up “,都是报一样的错.执行cleanup时候,提示要cleanup.看来是进入死循环了. 可能是频繁做了一些改名,文件打开的时候更新或者提交操作,导致svn罢工了.这个也该算是svn的bug吧.类似的情况,其实之前也碰到过.之前都是图省事,把整

执行yiic webapp命令时报错:php.exe不是内部或外部命令,也不是可运行的程序

在执行 yiic webapp ../abc 命令时报错: “php.exe”不是内部或外部命令,也不是可运行的程序 或批处理文件. 这是因为yiic批处理程序找不到php.exe的执行路径引起的. 解决方法: 打开yiic.bat文件, 将php.exe的绝对路径赋值给PHP_COMMAND,将: if “%PHP_COMMAND%” == “” set PHP_COMMAND=php.exe 改为 if “%PHP_COMMAND%” == “” set PHP_COMMAND=E:\xam

Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法

Laravel 5.4 Mix & Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法 首先进入package.json文件,将scripts下的所有cross-env删除掉,(devDependencies下的不能删除)处理结果代码如下: { "private": true, "scripts": { "dev": "npm run development&qu

在执行inoic创建项目时报错

在执行inoic创建项目时报错.主要错误是:operation not permitted, scandir 1 × Running command - failed! 2 [ERROR] npm ERR! path C:\Users\Administrator\cutePuppyPics\node_modules\fsevents\node_modules\dashdash\node_modul 3 4 npm ERR! code EPERM 5 npm ERR! errno -4048 6

安装webpack后,执行webpack -v命令时报错:SyntaxError: Block-sc

安装webpack后,执行webpack -v命令时报错如下: [[email protected] ~]# webpack -v /usr/local/node-v4.4.7-linux-x64/lib/node_modules/webpack/bin/webpack.js:3 let webpackCliInstalled = false; ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not

mysql数据库种类介绍及 mysqldump备份数据

一  Nosql 指的是非关系型数据库,作为传统关系型数据库的一个有效补充,针对特定场景.以高性能和使用便利为目一 的功能特异化的数据库产品 Nosql特点: Noosql数据库存储不需要固定的表结构 1 他不是否定关系数据库,而是作为关系数据库的一个重要补充 2 Nosql为了高性能高并发而产生的 3 Nosql典型产品memcache(纯内存) 一重启就丢数据 redis(持久化缓存)  持久化缓存 mongodb 二  非关系型数据库种类: 1 键值存储数据库 2 列存储数据库 3 面向文

怎么恢复用mysqldump备份数据和恢复数据

1.备份: 写一个脚本: !/bin/bash` echo 'dump begin' Now=$(date +%d-%m-%Y--%H:%M:%S) //获取当前时间 File=backup-$Now.sql.gz //组成文件名 mysqldump -u zc_test -pzc_test2016 -h test.rtdream.com --port 3307 --all-databases --single-transaction --routines --add-drop-table --

使用mysqldump备份数据库时报Got error: 2013错误

mysqldump备份数据库是一种比较简单及方便的方法,但它也消耗一定量的内存.可话又说回来了,数据库的哪个工作不消耗内存,若不消耗内存就能完成管理的DBA那不是DBA那是神--大神.说了一些找抬扛的话,若你找跟我扛那就不必了,你赢了.呵呵!咱们言归正传啊. 今天用mysqldump工具做数据库备份时,报出这样一个错误:"Got error: 2013: Lost connection to MySQL server during query when using lock tables&quo