Is it possible to recover a deleted row in MySQL?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
shree
Forum Newbie
Posts: 1
Joined: Tue Aug 05, 2008 1:44 am

Is it possible to recover a deleted row in MySQL?

Post 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?
Last edited by RobertGonzalez on Tue Aug 05, 2008 4:42 pm, edited 1 time in total.
Reason: Post title was very vague and against the rules. Changed to be more descriptive.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Hi..

Post by jaoudestudios »

Not as far as I know, did you take a backup before?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: Hi..

Post by RobertGonzalez »

A delete is permanent in a database. Sorry, you will have to just recreate the row.
User avatar
Chalks
Forum Contributor
Posts: 447
Joined: Thu Jul 12, 2007 7:55 am
Location: Indiana

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

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

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

Post 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.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

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

Post 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.
Post Reply