前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >排障集锦:九九八十一难之第九难!mysql备份恢复路上的小插曲

排障集锦:九九八十一难之第九难!mysql备份恢复路上的小插曲

作者头像
不吃小白菜
发布2020-09-03 10:23:48
6830
发布2020-09-03 10:23:48
举报
文章被收录于专栏:用户7721898的专栏

问题描述一 断点恢复ERROR 1146 (42S02) at line 35: Table ‘shang.info’ doesn’t exist

代码语言:javascript
复制
[root@localhost opt]# mysqlbinlog --no-defaults --stop-datetime='2020-08-23 13:29:04' /usr/local/mysql/data/mysql-bin.000002 | mysql -uroot -p
Enter password: 
ERROR 1146 (42S02) at line 35: Table 'shang.info' doesn't exist

解决思路

断点恢复之前进行完全备份

代码语言:javascript
复制
mysql> source /opt/shang.sql;

问题描述二、 完全备份后无法进行数据恢复

ERROR 1146 (42S02): Table ‘shang.shang’ doesn’t exist

代码语言:javascript
复制
[root@localhost opt]# mysql -uroot -pAbc123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.17-log Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source /opt/shang.sql;    '进行数据恢复'
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> select * from shang;     '一直报错'
ERROR 1146 (42S02): Table 'shang.shang' doesn't exist

解决方案

1、查看备份.sql 具体如下

代码语言:javascript
复制
-- Table structure for table `info`    
--

DROP TABLE IF EXISTS `info`;    '首先判断info表是否存在,如果存在的话才能接一下操作'
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `info` (
  `id` int(11) NOT NULL,
  `name` char(4) NOT NULL,
  `score` decimal(5,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

2、定位问题

回到数据库中 进入到绝对路径具体的库中 进行重新恢复

代码语言:javascript
复制
mysql> use shang;
Database changed
mysql> source /opt/shang.sql;
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
mysql> select * from info;
+----+------+-------+
| id | name | score |
+----+------+-------+
|  1 | zhen | 99.00 |
|  2 | qqqq | 88.00 |
|  3 | wwww | 77.00 |
+----+------+-------+
3 rows in set (0.00 sec)
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/08/23 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题描述一 断点恢复ERROR 1146 (42S02) at line 35: Table ‘shang.info’ doesn’t exist
  • 解决思路
  • 问题描述二、 完全备份后无法进行数据恢复
    • ERROR 1146 (42S02): Table ‘shang.shang’ doesn’t exist
    • 解决方案
      • 1、查看备份.sql 具体如下
        • 2、定位问题
        相关产品与服务
        云数据库 MySQL
        腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档