简体   繁体   中英

MySQL rollback when auto_commit is on

by mistake I fired an update query and all the records in the table in dat field got updated and also cannot rollback as auto_commit is on.

Is there any other way to retrieve the records?

I don't think you can rollback a query/transaction once it's been commited (and, here, it has) : the old data has been replaced by the new one, and has disappeared.

As possible solutions :

  • If possible, depending on the update you did, there might be a way to revert that update ?
  • Else, I hope you have frequent backups, and know how to restore them (to a temporary database, if necessary, to extract the informations you need, and re-import it into your production database "by had") ...

You can get the records but they are in the state of the last update. Rollback does not work, cause the transaction is closed already. (auto_commit on).

如果启用了二进制日志记录 ,则可以从备份还原数据库,然后从二进制日志中提取备份时间和错误查询之间的所有更改,然后将其重新应用于数据库。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM