I used update sql to update a table,but i forget "where",one column all data to null. How can I do to let the data recovery to before update operate? Please help me!!
Asked
Active
Viewed 341 times
0
-
I think this is a [duplicate](http://stackoverflow.com/questions/2918831/how-to-undo-mysql-query). – Mark Jun 20 '13 at 09:20
1 Answers
3
If you define table type as InnoDB, you can use transactions (see the link below). You will need set AUTOCOMMIT=0, and after you can issue COMMIT or ROLLBACK at the end of query or session to submit or cancel a transaction.
ROLLBACK -- will undo the changes that you have made

Mark
- 8,046
- 15
- 48
- 78
-
My table type is MyISAM,There have .MYI\.MYD\.frm files in data directory, and now there is a select operate after update... – yp zhou Jun 20 '13 at 09:31
-
If you committed your transaction, it's time to dust off that backup, sorry. But that's what backups are for. I did something like that once myself. No luck for that. There is no way you can undo that. – Mark Jun 20 '13 at 09:34
-
-
-
Even you have Binary Log Enabled that doesn't mean anything. According to [this](http://www.xaprb.com/blog/2009/01/01/how-to-use-mysql-binlogs-to-undo-a-drop-statement/). You cannot use the binary logs to undo unwanted changes to your data. – Mark Jun 20 '13 at 09:46
-
If i have Binary Log I can recovery it to the log datatime.Most of the data can be obtained. – yp zhou Jun 20 '13 at 09:52