Home  >  Q&A  >  body text

mysql - sql数据还原

执行sql语句如下:

update main set state = 'process'

本来应该是要执行

update main set state = 'process' where id = '8136' 

由于忘记了加条件,导致好十万的数据全部状态改错了。有没有办法将之前的数据还原的,之前没有做数据备份的啊?(当然我是测试环境的数据。但是状态不对,也会对业务线有影响的。)

求解。。

天蓬老师天蓬老师2743 days ago687

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-17 14:55:59

    The update operation is automatically committed and there is no way to roll it back. You can only check whether the binlog is enabled, and then go to the log to find the data
    Reference article: http://database.51cto.com/art/ 201212/374563.htm

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 14:55:59

    Try using rollback first. If it doesn’t work, check to see if there is a binlog.
    If not, let me give you an idea:
    If you damage the hard drive, just tell the leader that the hard drive is broken!

    reply
    0
  • PHPz

    PHPz2017-04-17 14:55:59

    Well, when such a tragedy occurs, we can only find binlog as the last straw.

    So the standard operation is: back up the table before all INSERT, UPDATE, DELETE operations. Don’t trust your brain and paws.

    reply
    0
  • Cancelreply