利用物理备份库文件+binlog文件恢复备份数据报错一例

利用物理备份库文件+binlog文件恢复备份数据报错一例_unix

开场白:心灵毒鸡汤
很喜欢稻盛和夫的一段话:
人这一生,终究要敢与自己对抗,才有资本与自己和解,当你的内心足够坚定的时候,任谁也没办法影响你。人要学会自愈,不去抱怨,不怕孤单,努力沉淀,生活没有那么多如愿以偿,能将你从低谷里拖出来的,从来不是时间,而是你心里的格局和你发自内心的那股释怀。
无论你经历了什么,记得带上你的善良和感恩,去遇见温暖和幸福,好好生活,好好工作,该忘的就忘,该放的就放,让心归零,微笑前行!

## 《让我们开始今天的分享内容》

导入物理备份表空间,MySQL的日志报错如下:

time mysql -uroot  -f < /data2/export/220419.import.test_db.txt
2022-04-19T14:36:28.421454+08:00 14 [ERROR] InnoDB: Column table_name in table `mysql`.`innodb_table_stats` is VARCHAR(597) NOT NULL but should be VARCHAR(192) NOT NULL (length mismatch).
2022-04-19T14:36:28.421481+08:00 14 [Warning] InnoDB: Recalculation of persistent statistics requested for table `test_db`.`t_bill_detail_cycle_ext` but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2022-04-19T11:31:30.604245+08:00 7 [ERROR] InnoDB: Column table_name in table `mysql`.`innodb_table_stats` is VARCHAR(597) NOT NULL but should be VARCHAR(192) NOT NULL (length mismatch).
2022-04-19T11:31:30.616742+08:00 7 [ERROR] InnoDB: Column table_name in table `mysql`.`innodb_table_stats` is VARCHAR(597) NOT NULL but should be VARCHAR(192) NOT NULL (length mismatch).
2022-04-19T11:35:17.834138+08:00 12 [ERROR] InnoDB: Column table_name in table `mysql`.`innodb_table_stats` is VARCHAR(597) NOT NULL but should be VARCHAR(192) NOT NULL (length mismatch).
2022-04-19T11:35:17.834188+08:00 12 [ERROR] InnoDB: Fetch of persistent statistics requested for table `test_db`.`b_bill_add_service_amount` but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2022-04-19T11:35:17.934538+08:00 12 [ERROR] InnoDB: Column table_name in table `mysql`.`innodb_table_stats` is VARCHAR(597) NOT NULL but should be VARCHAR(192) NOT NULL (length mismatch).
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.

原因:备份库的版本为mysql5.7.32 但是恢复到测试库时 测试库的版本是:mysql5.7.22 数据库版本不一致导致的报错
解决办法: 保证备份库和恢复的测试库的mysql版本一致

再小记一个磁盘满导致 数据库服务启动失败的案例:

/分区磁盘满了导致的下面的报错:

2022-04-20T21:29:15.701327+08:00 0 [ERROR] Could not write unix socket lock file /tmp/mysql.sock.lock errno 28.
2022-04-20T21:29:15.701335+08:00 0 [ERROR] Unable to setup unix socket lock file.
2022-04-20T21:29:15.701339+08:00 0 [ERROR] Aborting
  • 1.
  • 2.
  • 3.

腾出/ 分区磁盘空间,再次启动mysql服务 还是启动失败。
/usr/local/mysql/bin/mysqld --defaults-file=/data1/3307/my.cnf &
报错如下:

2022-04-20T21:32:29.986245+08:00 0 [ERROR] Unix socket lock file is empty /tmp/mysql.sock.lock.
2022-04-20T21:32:29.986251+08:00 0 [ERROR] Unable to setup unix socket lock file.
2022-04-20T21:32:29.986256+08:00 0 [ERROR] Aborting
  • 1.
  • 2.
  • 3.

解决办法: 需要删除之前启动MySQL服务生成的socket文件/tmp/mysql.sock.lock 重新启动可以

[root@tidb05 local]# ll /tmp/mysql.sock.lock 
-rw------- 1 mysql mysql 5 Apr 20 21:34 /tmp/mysql.sock.lock
rm -f /tmp/mysql.sock.lock 
  • 1.
  • 2.
  • 3.

总结演示到此处吧,虽然都是不起眼的报错故障。但是总结一下吧,每天进步一点点。Nice!!!

posted @ 2022-04-22 20:20  勤奋的蓝猫  阅读(5)  评论(0编辑  收藏  举报  来源