Search code examples
mysqldelete-rowsql-delete

Retrieving deleted rows from MYSQL Database


I have accidentally deleted all rows of the database is there a way to retrieve them back. Since I am working of department server I wont be take backup. But I know in oracle I could rollback the DML commands. I tried to use rollback but its not working?

or I have to create whole data base again?


Solution

  • Sorry, but if the transaction with the delete statement has already been committed then I don't think you can recover the lost data unless you have a backup.

    To avoid this accident, I'd advise always testing your WHERE clause using a SELECT query first, before running a DELETE statement. Then you will notice if it will delete rows that you didn't intend to delete.