mysqldump备份失败以及解决方法汇总〇 mysqldump: Error: Query execution was interrupted, maximum statement execution time exceeded when trying to dump tablespaces

〇 mysqldump: Error 3024: Query execution was interrupted, maximum statement execution time exceeded when dumping table `$tb_name` at row: xxxx

版本:

MySQL 5.7.8+

原因:

max_execution_time过小

处理思路:

① 通过hints,增大N值(文档说,在hints用法中,将N改为0为无限制,但我测下来不生效,可设置成一个较大值如999999解决)

SELECT /*+ MAX_EXECUTION_TIME(N) */ * FROM t1 LIMIT 100000;

② 修改max_execution_time值,将该值设置为较大一个值,或设置为0(不限制)

附录:

该参数5.7.8被添加,单位为ms,动态参数,默认为0,设置为0时意味着SELECT超时不被设置(不限制超时时间)。不作用于存储过程中的SELECT语句,并且只作用于只读的SELECT,如INSERT ... SELECT ... 是不被作用的。

for more information:

http://blog.itpub.net/29773961/viewspace-2150443/〇 mysqldump: Couldnt execute SHOW FIELDS FROM `$view_name`: View $db_name.$view_name references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)

原因:

该view引用了无效的表,列,函数或者定义者。

处理思路:

可以根据报错信息,进入db,执行SHOW CREATE VIEW $view_name\G,查看该view的定义,逐一检查该view的基表,列,或相关函数与用户是否具有相关权限。考虑重建或删除视图。〇 mysqldump: Couldnt execute show create table `$view_name`: Illegal mix of collations for operation UNION (1271)

原因:

创建view时,使用UNION时存在非法的排序规则组合。

处理思路:

检查该视图定义,检查字符集,考虑重建或删除视图。〇 mysqldump: Couldnt execute SHOW FIELDS FROM `$view_name`: The user specified as a definer ($user@$host) does not exist (1449)

〇 mysqldump: Couldnt execute show table status like $view_name: SELECT command denied to user @% for column $col_name in table $tb_name (1143)

原因:

该视图的定义者$user@$host不存在。

处理思路:

检查mysql.user表,确认用户是否存在,考虑重建或删除视图。〇 Error: Couldnt read status information for table Income_config ()mysqldump: Couldnt execute show create table `Tser_table`: Table $db_name.test_table doesnt exist (1146)

〇 mysqldump: Got error: 1049: Unknown database $db_name when selecting the database

原因一:

从lower_case_table_names的0设置成1,导致部分原来含有大写字母的库表“找不到”。

处理思路:

将lower_case_table_names设置回0。

若有必须将lower_case_table_names设置为1,需先设置为0,并将含有大写字母的库表改成小写,再设置为1。

原因二(MySQL 5.5及以下版本可能出现):

表损坏导致该表找不到(InnoDB)。frm和ibd文件都在,但无法SHOW CREATE TABLE xxx\G

error log一则:170820 17:43:17 [Note] Event Scheduler: scheduler thread started with id 1

170820 17:44:48 InnoDB: error: space object of table '$db_name/$tb_name',

InnoDB: space id 4335 did not exist in memory. Retrying an open.

170820 17:44:48 InnoDB: Error: tablespace id and flags in file './$db_name/$tb_name.ibd' are 0 and 0, but in the InnoDB

InnoDB: data dictionary they are 4335 and 0.

InnoDB: Have you moved InnoDB .ibd files around without using the

InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?

InnoDB: Please refer to

InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting-datadict.html

InnoDB: for how to resolve the issue.

170820 17:44:48 InnoDB: cannot calculate statistics for table $db_name/$tb_name

InnoDB: because the .ibd file is missing. For help, please refer to

InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html

170820 17:44:48 [ERROR] MySQL is trying to open a table handle but the .ibd file for

table $db_name/$tb_name does not exist.

Have you deleted the .ibd file from the database directory under

the MySQL datadir, or have you used DISCARD TABLESPACE?

See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html

how you can resolve the problem.

处理思路:

从完整备份+binlog还原,对于有主或从的实例,可通过物理备份还原。〇 mysqldump: Error 2020: Got packet bigger than max_allowed_packet bytes when dumping table `$tb_name` at row: xxxx

原因:

默认的max_allowed_packet过小

处理思路:

在mysqldump时增加max_allowed_packet的大小,如mysqldump --max-allowed-packet=268435456〇 mysqldump: Error 1412: Table definition has changed, please retry transaction when dumping table `$tb_name` at row: 0

原因:

在备份该表时,表定义被修改。FLUSH TABLE WITH READ LOCK只保证数据一致性,并不保证schema不被修改。

处理思路:

备份时期不做DDL操作。

复现一:① session1> CREATE TABLE a (id int) ENGINE=InnoDB;

② session2> START TRANSACTION WITH CONSISTENT SNAPSHOT;

③ session1> ALTER TABLE a ADD COLUMN name varchar(32);

④ session2> SELECT * FROM a;

ERROR 1412 (HY000): Table definition has changed, please retry transaction

p.s. 如果③和④调换顺序,则ALTER TABLE无法成功,则会等待MDL。

复现二:① session1> START TRANSACTION WITH CONSISTENT SNAPSHOT;

② session2> CREATE TABLE b (id int) ENGINE=InnoDB;

③ session1> SELECT * FROM b;

ERROR 1412 (HY000): Table definition has changed, please retry transaction

〇 mysqldump: Couldnt execute show create table `$tb_name`: Unable to open underlying table which is differently defined or of non-MyISAM type or doesnt exist (1168)

原因:

出现在表引擎为MERGE时,备份到该表时,发现该表定义存在问题。可能merge的表不存在,或者该表合并的基表包含非MyISAM引擎的表。

处理思路:

删除或者重建该MERGE表。

复现一(merge表中定义包含了非MyISAM表):CREATE TABLE t1(id int) ENGINE=InnoDB;

CREATE TABLE t2(id int) ENGINE=MyISAM;

CREATE TABLE merge_t(id int)ENGINE=MERGE UNION=(t1, t2);

SELECT * FROM merge_t;

ERROR 1168 (HY000): Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist

复现二(表不存在):CREATE TABLE t1(id int) ENGINE=MyISAM;

CREATE TABLE t2(id int) ENGINE=MyISAM;

CREATE TABLE merge_t(id int)ENGINE=MERGE UNION=(t1, t2);

SELECT * FROM merge_t;

Empty set (0.00 sec)-- 正常返回

DROP TABLE t1;

SELECT * FROM merge_t;

ERROR 1168 (HY000): Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist

附录:

通过check table merge_t可以检查是哪张表有问题,如此处是t1:[15:20:12] root@localhost [test]> check table merge_t\G

*************************** 1. row ***************************

Table: test.merge_t

Op: check

Msg_type: Error

Msg_text: Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist

*************************** 2. row ***************************

Table: test.merge_t

Op: check

Msg_type: Error

Msg_text: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist

*************************** 3. row ***************************

Table: test.merge_t

Op: check

Msg_type: error

Msg_text: Corrupt

3 rows in set (0.00 sec)

通过cat表MGR��义结构文件可以检查MERGE表的基表:

[root@host test]# pwd

/data/mysql-data/mysql57/data/test

[root@host test]# cat merge_t.MRG

t1

t2

〇 mysqldump: Couldnt execute show create table `$tb_name`: Table ./$db_name/$tb_name is marked as crashed and last (automatic?) repair failed (144)

〇 mysqldump: Couldnt execute show create table `$tb_name`: Table ./$db_name/$tb_name is marked as crashed and should be repaired (145)

〇 mysqldump: Error 1194: Table throne_tower is marked as crashed and should be repaired when dumping table `$tb_name` at row: xxxxx

原因:

mysqldump在拉取表定义时报错,表损坏。

处理思路:

该损坏发生在非事务表如MyISAM,通过mysqlcheck或者repair table修复即可。〇 mysqldump: Couldnt execute SHOW FUNCTION STATUS WHERE Db = $db_name: Cannot load from mysql.$tb_name. The table is probably corrupted (1728)

原因:

字典表不正确,可能是表本身损坏,也有可能是导入了其他版本的mysql schema盖掉了字典表。

处理思路:

repair table修复,若仍无用,则可以尝试mysql_upgrade来修复,或找到对应版本的mysql_system_tables_fix.sql来导入。〇 mysqldump: Couldnt execute show events: Cannot proceed because system tables used by Event Scheduler were found damaged at server start (1577)

原因:

字典表不正确,极大可能是导入了其他版本的mysql schema盖掉了字典表。

处理思路:

尝试mysql_upgrade来修复,或找到对应版本的mysql_system_tables_fix.sql来导入。该报错可能在upgrade操作之后重启实例。〇 mysqldump: Error: Got error 28 from storage engine when trying to dump tablespaces

mysqldump: Couldnt execute show fields from `$tb_name`: Got error 28 from storage engine (1030)

原因:

@@tmpdir满了。

处理思路:

清除@@tmpdir,可以通过SELECT @@tmpdir;检查具体目录。〇 mysqldump: Lost connection to MySQL server during query (2013)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '@@socket' (111)

原因:

mysqldump执行过程中mysqld被关闭。

处理思路:

检查mysqld被关闭的原因,一般常见原因是发生OOM。〇 mysqldump: Couldn't execute 'SHOW SLAVE STATUS': Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation (1227)

原因:

mysqldump加了--dump-slave参数,缺少SUPER或REPLICATION CLIENT来执行SHOW SLAVE STATUS。

处理思路:

检查mysqldump的用户权限。〇 mysqldump: Couldn't execute 'STOP SLAVE SQL_THREAD': Access denied for user 'dump'@'localhost' (using password: YES) (1045)

原因:

mysqldump加了--dump-slave参数,缺少SUPER权限使用STOP SLAVE SQL_THREAD。

处理思路:

检查mysqldump的用户权限。

存储过程mysql报错1271_mysqldump备份失败以及解决方法汇总相关推荐

  1. mysql 报错 lock wait timeout exceeded 解决方法

    Mysql造成锁的情况有很多,下面我们就列举一些情况: 执行DML操作没有commit,再执行删除操作就会锁表. 在同一事务内先后对同一条数据进行插入和更新操作. 表索引设计不当,导致数据库出现死锁. ...

  2. 关于MySQL连接Navicat Premium 12失败的解决方法

    关于MySQL连接Navicat Premium 12失败的解决方法 参考文章: (1)关于MySQL连接Navicat Premium 12失败的解决方法 (2)https://www.cnblog ...

  3. python https请求报错:SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 解决方法

    python爬虫,使用requests库发送https请求报错:SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 解决方法: imp ...

  4. 转)VCSA 6.5重启无法访问,报错“503 Service Unavailable”的解决方法

    转)VCSA 6.5重启无法访问,报错"503 Service Unavailable"的解决方法 1. 问题 重启vcenter,登陆vsphere client,提示 &quo ...

  5. vs2010一运行就报错deven.exe assert failure 解决方法,卸载系统中.netFramework最新版本的(简体中文)...

    vs2010一运行就报错deven.exe assert failure 解决方法,卸载系统中.netFramework最新版本的(简体中文) 转载于:https://www.cnblogs.com/ ...

  6. 微信二次分享签名错误php,微信二次分享报错invalid signature问题及解决方法

    基于微信公众号开发的h5页面(使用jssdk接口),由用户A分享给用户B,用户B再次分享这个页面时,不能成功分享.问题出在用户B收到的分享链接与用户A打开的链接不同 A用户的链接为 B用户收到的连接 ...

  7. 程序执行报错Missing Connection or ConnectionString 解决方法

    程序执行报错Missing Connection or ConnectionString 解决方法 参考文章: (1)程序执行报错Missing Connection or ConnectionStr ...

  8. 使用mysql workbench导入csv文件失败的解决方法

    使用mysql workbench导入csv文件失败的解决方法 解决方法: 1.用记事本打开csv文件,另存的时候,文件名后缀为.csv,保存类型为文本文档,编码方式utf-8. 2.打开workbe ...

  9. dedecms后台报错“Undefined variable cfg_domain_cookie”的解决方法

    dedecms后台报错"Undefined variable cfg_domain_cookie"的解决方法 打开调试模式 Notice: Undefined variable: ...

最新文章

  1. 助力企业抗疫,360金融推出免费AI语音机器人
  2. 联想lenovo Z470笔记本的驱动安装
  3. [Web开发] 微软的 PHP+IIS+WinServer 开发培训资料/示例代码
  4. 构造函数的初始化,初始化列表还是大括号里好,那种效率高
  5. 3项目里面全局用less变量 cli vue_vue-cli3 如何全局引入less变量
  6. 感谢所有常来我博客的朋友
  7. String 类型ID 获取
  8. 为什么设置 height 100% 不起作用
  9. 淘宝客APP带自营商城本地生活CPS外卖优惠电影票话费更新渠道跟单生活特权V3
  10. ProgressBar 圆形进度条
  11. 2020-02-21
  12. 智能客服搭建(4) - 语音流的分贝计算
  13. LSB 图像隐写与提取算法
  14. 服务器iso文件如何打开方式,iso文件怎么打开(iso文件用什么打开)
  15. HTML获取当前IP和当前位置
  16. 笔记本电脑上的以太网消失或者无法识别问题
  17. dva的用法_dva入门讲解
  18. 2022年的电视评判标准,为何还要强调画质?
  19. 【Maya开发基础】全局缩放补偿
  20. Mtk Camera中Hal1/Hal3的Picture size和Preview size配置

热门文章

  1. 拥抱.NET Core系列:依赖注入(2)
  2. 编程语言的发展趋势及未来方向(4):动态语言
  3. 第二篇 Entity Framework Plus 之 Query Future
  4. 中国区域Modis行列号(附Shapefile文件下载)
  5. Java线程安全以及线程安全的实现方式和内存模型(JMM)
  6. C++之‘nullptr’ was not declared in this scope
  7. 里rust怎么找蓝图_Rust错误处理
  8. html页面阴影怎么做,html – 做弯曲阴影的最佳方式
  9. #时间预测算法_【时间序列】时序预测竞赛之异常检测算法综述
  10. sql limit不接具体数字_这21个写SQL的好习惯,你要养成呀