问题描述
我犯了一个大错误,就是我在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中提交后,有什么方法可以回滚吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!