错误的 MySQL 更新查询后恢复?

Recovery after wrong MySQL update query?(错误的 MySQL 更新查询后恢复?)

本文介绍了错误的 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 更新查询后恢复?

基础教程推荐