Page 1 of 1

Is it possible to recover a deleted row in MySQL?

Posted: Tue Aug 05, 2008 1:50 am
by shree
In the phpMyAdmin, i deleted one row in a table.. But that contains lot of data. And i need that with all the related data. How can i recover the deleted row? is there any solutions?

Re: Hi..

Posted: Tue Aug 05, 2008 2:33 am
by jaoudestudios
Not as far as I know, did you take a backup before?

Re: Hi..

Posted: Tue Aug 05, 2008 4:41 pm
by RobertGonzalez
A delete is permanent in a database. Sorry, you will have to just recreate the row.

Re: Is it possible to recover a deleted row in MySQL?

Posted: Tue Aug 05, 2008 4:44 pm
by Chalks
incidentally, I've taken to adding an additional column to all of my databases called "deleted". when I delete a column, the flag deleted is toggled on, and any other entries that were previously tagged as deleted are actually removed. That way I can always undo the most recent delete if I need to. My customers like "undo" buttons too.

Re: Is it possible to recover a deleted row in MySQL?

Posted: Tue Aug 05, 2008 10:20 pm
by califdon
Chalks wrote:incidentally, I've taken to adding an additional column to all of my databases called "deleted". when I delete a column, the flag deleted is toggled on, and any other entries that were previously tagged as deleted are actually removed. That way I can always undo the most recent delete if I need to. My customers like "undo" buttons too.
Excellent practice.

Re: Is it possible to recover a deleted row in MySQL?

Posted: Wed Aug 06, 2008 9:54 am
by jayshields
Yeah, that is a great idea.

I use something similar on a current website. I have a date_removed column (which is NULL by default), and when the row is deleted, the field is set to NOW(). Then, everytime the user logs in, it looks for rows with the date_removed field set to something, and if it's older than one month, it gets deleted properly.