Is it possible to recover a deleted row in MySQL?
Moderator: General Moderators
Is it possible to recover a deleted row in MySQL?
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.
Reason: Post title was very vague and against the rules. Changed to be more descriptive.
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Hi..
Not as far as I know, did you take a backup before?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: Hi..
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?
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?
Excellent practice.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.
- 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?
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.
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.