How can I undo my last delete command in mysql?

I accidentally deleted a huge amount. rows from the table.

How can I push it back?

I fulfilled the request using putty ...

I would appreciate it if any of you can safely guide me with this.

+46
sql mysql sql-delete rollback
Mar 01 '10 at 14:48
source share
8 answers

if you haven’t backed up, you are faked.

+76
Mar 01 '10 at 14:50
source share

If you have not completed the transaction, try rollback . If you have already committed a transaction (via commit or by leaving the command line client), you must restore the data from your last backup.

+22
Mar 01
source share

Rollback only works if you used transactions . This way you can group requests together and cancel all requests if only one of them fails.

But if you have already made a transaction (or used a regular DELETE request), the only way to return your data is to restore it from a previously made backup.

+8
Mar 01
source share

The accepted answer is not always correct. If you configure the binary log on mysql, you can roll back the database to any previous point where there is still a snapshot and binlog. http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html is a good starting point to explore this object.

+3
Feb 16 '15 at 16:57
source share

use the BEGIN TRANSACTION command before running queries. So you can ROLLBACK things at any given time.

FOR EXAMPLE:

  • start a transaction
  • select * from Student
  • remove from Student where Id = 2
  • select * from Student
  • Rollback
  • select * from Student
+2
Aug 20 '16 at 12:39 on
source share

Rollback usually does not work on these deletion features, and of course, a backup can save you. If there is no backup, then there is no way to restore it, because deletion requests launched on putty, derby using .sql files are automatically included after the deletion request is launched.

0
Aug 21 '13 at 11:30
source share

If you need rollback data in the first place, you need to run autocommit = 0, and then do a query deletion, insert, or update. After completing the request, roll back ....

0
Aug 04 '16 at 5:53 on
source share

i also deleted some values ​​from my development database, but I had the same copy in the QA database, so I made the generated script and the selected option “data type to script” to “data only” and selected my table and then I received insert instructions with the same data, and then I ran a script in my development database.

0
Oct 18 '17 at 13:30
source share



All Articles