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

查看:26
本文介绍了在 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 的情况下,它是 mysqlbinlog) 以重播"自备份回数据库以来日志中的所有数据修改查询,但跳过问题查询.

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天全站免登陆