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 更新查询后恢复?


- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 更改自动增量起始编号? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- SQL 临时表问题 2022-01-01