Recovery after wrong MySQL update query?(错误的 MySQL 更新查询后恢复?)
问题描述
我在表中进行了错误的更新查询.
I made a wrong update query in my table.
我忘记在 WHERE 子句中创建一个 id 字段.
I forgot to make an id field in the WHERE clause.
这样就更新了我所有的行.
So that updated all my rows.
如何恢复?
我没有备份....
推荐答案
对不起,恢复覆盖的机会 MySQL 数据库通常接近于零.与删除文件不同,在大多数情况下,覆盖记录实际上会覆盖现有数据.
Sorry man, but the chances of restoring an overwritten MySQL database are usually close to zero. Different from deleting a file, overwriting a record actually and physically overwrites the existing data in most cases.
要做好准备,如果出现任何问题,您应该停止 MySQL 服务器,并复制包含数据库的物理目录,这样就不会进一步覆盖任何内容:将数据文件夹简单复制 + 粘贴到其他位置应该做.
To be prepared if anything comes up here, you should stop your MySQL server, and make a copy of the physical directory containing the database so nothing can get overwritten further: A simple copy+paste of the data folder to a different location should do.
但不要抱太大希望 - 我认为真的没有什么可以做的.
But don't get your hopes up - I think there's nothing that can be done really.
您可能希望为将来设置频繁的数据库备份.周围有很多解决方案;MySQL 自己的 mysqldump.
You may want to set up a frequent database backup for the future. There are many solutions around; one of the simplest, most reliable and easiest to automate (using at or cron in Linux, or the task scheduler in Windows) is MySQL's own mysqldump.
这篇关于错误的 MySQL 更新查询后恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:错误的 MySQL 更新查询后恢复?
基础教程推荐
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 无法解决整理冲突 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
