Home  >  Q&A  >  body text

mysql update 如何回滚?

昨天晚上手贱update一张表,忘加限制条件了,本来应该是
update companys set right=1 where id =1234

后面的where id=1234忘加了,结果所有数据都update了。欲哭无泪。
请问怎么回滚呢?
求大神救急

天蓬老师天蓬老师2742 days ago1146

reply all(4)I'll reply

  • PHPz

    PHPz2017-04-17 14:50:29

    It’s already too late, because only transactions can assist in completing the rollback, and what you have already completed cannot be rolled back! Unless you have done a database backup~

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 14:50:29

    Have you turned on the binary log? You should be able to restore it to before the update

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 14:50:29

    Have you opened the bin-log in your database? If so, open the statement where you were found and restore the replay of the bin-log of the misoperation statement.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 14:50:29

    You can use binlog2sql to quickly roll back. For specific methods, please see this article "How to quickly recover data after MySQL misoperation"

    reply
    0
  • Cancelreply