Gossamer Forum
Home : Products : Others : MySQLMan :

I stuffed up --- how do I 'undo' an update command?

Quote Reply
I stuffed up --- how do I 'undo' an update command?
Using a cgi script I accidentally over-wrote most of the fields in all the rows in a table with the same information (repeating).

**update x=y, z=a where id

I have been searching everywhere on how to undo the command (if possible) or get to the backup info.

The best I could find was restore but that can only be use with an empty table, I really have no idea how to get the info back...and am really not finding much help in the man pages.

Last edited by:

reg-: Apr 30, 2002, 11:57 PM
Quote Reply
Re: [reg-] I stuffed up --- how do I 'undo' an update command? In reply to
You can't restore overwritten info...you'd have to restore from a backup.
Quote Reply
Re: [Paul] I stuffed up --- how do I 'undo' an update command? In reply to
Yeah, that is what I thought. Problem is i have been having a really battle with mysql trying to get to the backup.

I have full server access to all dirs and files, have tried the restore command, mysqlhotcopy and import methods and am really at a loss.

Any advise on how to reload the backup info back into the overwritten table?

This is a bit over my head.
Quote Reply
Re: [reg-] I stuffed up --- how do I 'undo' an update command? In reply to
mysql -u username -p password database < /path/to/file.txt
Quote Reply
Re: [Paul] I stuffed up --- how do I 'undo' an update command? In reply to
all i have are the .MYD, .MYI, and the .frm files...

have been playing with the restore command, can you shed some light on why i am getting a "failed copying .frm file" in the return messages from the attempted restore.

+--------+---------+----------+--------------------------+
| Table | Op | Msg_type | Msg_text |
+--------+---------+----------+--------------------------+
| office | restore | error | Failed copying .frm file |
+--------+---------+----------+--------------------------+

Have opened the path for complete acess for the action and the file does exist. I think i have done all that is necessary for the command to work but am still getting that error?
Quote Reply
Re: [reg-] I stuffed up --- how do I 'undo' an update command? In reply to
Oh you don't want to do an import then...you would need a dumped file to do that.

Basically you can just find your mysql data directory, normally something like:

/var/lib/mysql

...then just copy your files into the correct directory (there will be one with the name of your database.)

So for example if your database was "links_sql" you'd put your files into:

/var/lib/mysql/links_sql

Last edited by:

Paul: May 1, 2002, 1:01 AM
Quote Reply
Re: [Paul] I stuffed up --- how do I 'undo' an update command? In reply to
Cheers,

Thats what Im in the process if trying at the moment.

That will involve a stop/restart of the mysql daemon for it to take effect, will it not?

Am just being overly cautions there are a fair few databases in the same area and another 5 tables associated to the broken table and i really dont want to corrupt or erase any more data than I already have for the day.
Quote Reply
Re: [reg-] I stuffed up --- how do I 'undo' an update command? In reply to
>>
That will involve a stop/restart of the mysql daemon for it to take effect, will it not?
<<

No, it should work without....or at least mysqlman will pick it up without a restart.
Quote Reply
Re: [Paul] I stuffed up --- how do I 'undo' an update command? In reply to
Thanks for your help is all fixed up.Smile