Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-17-2003, 08:21 AM
|
#1
|
Member
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418
Rep:
|
PLEASE!!! Help with mySQL needed!!!
I made an error... (Stupid)
I wanted to update a record in a database, so in mysql i ran:
update table_name set column_name='my new data';
But, as you can see, i forgot the 'WHERE' clause, and now every row contains this data.
Is there some kind of trick to get the data back? (Some kind of Undo)
I tried 'rollback' but that generated an error. It looks like i did not activate rollback functionality. (autocommit)
Is there some logfile where I get the data back, or is there at least some logfile of the outpu of all commands I ran? (I saw a tee option, but never used it. Is there somewhere a default file with this info in it?)
Any help would be grately appriciated.
A very stupid and thus sad person.....
|
|
|
07-17-2003, 09:34 AM
|
#2
|
Member
Registered: Jun 2003
Location: Delaware
Distribution: Redhat 7.0, 7.2, 8.0, 9.0, FreeBSD 4.6.2
Posts: 51
Rep:
|
Unless you back up your data...
...you're pretty well up the creek. Backups are always highly recommended.
If this is a business system and you aren't ghosting your entire system, you should at least back up mission-critical data on a daily basis. This data includes your MySQL databases and possibly your entire /usr partition (in nearly every distro, this will also include your /home tree, because /home is usually a symlink to /usr/home).
I recommend, if you are using the box in question to maintain business-related data, that you invest in at least a 10GB tape drive. They aren't cheap, but they most certainly will give you a rollback of sorts in case this happens again. Also, turn off auto-commit as well. Much safer without it.
If you want information on backing up your MySQL tables, go to the documentation at http://www.mysql.com and search for both "mysqldump" and "backup" in the manual. I can't remember the section numbers offhand, but I believe they are 4.8.x. These tools will be invaluable, especially if set up with cron to automate the process.
|
|
|
07-17-2003, 11:26 AM
|
#3
|
Member
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418
Original Poster
Rep:
|
Quote:
Backups are always highly recommended.
|
Yup.... I know that... However, it wasn't a business critical system, so no real harm is caused. It was a table containing some kind of "weblog cq guestbook" for the users of my site.
But, one always finds out too late that one should have made a backup.....
Before i did the update statement, I did a select * statement.
So some records I could see the data of, so manually, i can put that in again. But my screen wasn't big enough to hold all records. I was hoping mysql (or even linux) kept some kind of logfile.
If there's someway of telling wich data was in it, before I ran the update statement, i would be helped alot. Then it's only going to take some time to get all the data back in, but at least I know what data there was....
Isn't there some logfile somewhere???? I'd settle with anything, as long as i can read the data that was in there. Getting it back into the database isn't the problem.....
|
|
|
07-17-2003, 05:08 PM
|
#4
|
Member
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418
Original Poster
Rep:
|
Does anyone know if its possible to find the data back? Or at least find out what used to be in there, so i can reinsert it???
|
|
|
07-18-2003, 01:49 AM
|
#5
|
Member
Registered: Oct 2001
Location: CAMBRIDGE, MA USA
Distribution: RH9 Kernel 2.4.20-18.9
Posts: 69
Rep:
|
Alas, shy of shipping your hard-drive off to a specialty lab, there is no real way of getting your data back.
Additionally, autocommit can only be turned off on InnoDB and BDB tables. See http://www.mysql.com/documentation/m...ce.html#COMMIT
As for log files, there is a history file associated with mysql the client: ~/.mysql_history . It won't have the output from your select * SQL, however.
If your data was generated via GET commands through your website, then you could whip up a perl script to recreate the data from your weblogs. If it was via POST, then unless your CGI/PHP/JSP, etc pages log information, that info is lost.
My 0.063 cents....
-G
|
|
|
07-18-2003, 03:35 AM
|
#6
|
Member
Registered: Mar 2003
Location: The Netherlands
Distribution: Red Hat 7.3, Red Hat 9, Solaris8, Slackware 10, Slax on USB, AIX, FreeBSD, WinXP, AIX, Ubuntu
Posts: 418
Original Poster
Rep:
|
Thanks all... It seems I just have to start over....
|
|
|
All times are GMT -5. The time now is 10:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|