Is there any way to rollback after commit in MySQL?

前端 未结 3 1850
挽巷
挽巷 2020-12-09 08:33

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

It is auto-committed.

Is there any way to rollback from it?

相关标签:
3条回答
  • 2020-12-09 09:08

    Look up transaction logs. I'll update with more info but the logs may only stay around for a limited time so time is of the essence!

    See: http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

    0 讨论(0)
  • 2020-12-09 09:14

    If you have enabled mysql binlog and also it is of ROW based format, then you can get the value for each row before & after the update. Using that you can restore the table's state.

    0 讨论(0)
  • 2020-12-09 09:27

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

    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.

    0 讨论(0)
提交回复
热议问题