在MySQL中提交后,有什么方法可以回滚吗? [英] Is there any way to rollback after commit in MySQL?

查看:707
本文介绍了在MySQL中提交后,有什么方法可以回滚吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我犯了一个大错误,就是我在MySQL中更新了一个没有'where'子句的表:'(

I did a big mistake that I updated a table without 'where' clause in MySQL :'(

它是自动提交的.

有什么办法可以回滚吗?

Is there any way to rollback from it?

推荐答案

否,没有查询可以撤消"已提交的修改数据的查询.

No, there's no query that will "undo" a committed data-modifying query.

如果您有数据库的备份,则可以还原备份并使用DBA工具(对于MySQL,它是

If you have a backup of the database, you can restore the backup and use DBA tools (in MySQL's case, it's mysqlbinlog) to "replay" all data-modifying queries from the logs since the backup back to the database, but skip over the problem query.

如果您没有备份以及该备份以来的所有日志,则无法采取任何措施来恢复数据.

If you don't have a backup and all logs since the that backup, there's nothing you can do to recover the data.

这篇关于在MySQL中提交后,有什么方法可以回滚吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆