Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Databases lost

Status
Not open for further replies.

Niclov

Programmer
Jun 28, 2001
45
CA
Ok, this put somewhat of a 'downer' on my day. After I finished rebooting my Linux box, before which I had shutdown MySQL, I noticed some of my PHP scripts were generating errors that they hadn't before. I check the MySQL database list and find out all my databases are missing! Is there a way to restore them, backup copies stored perhasps? And how can I prevent this from ever happening again? Any help would be greatly appreciated.

-Nick
 
It is not clear exactly what happened from your post. If
the database tables are not where they should be
(e.g. /var/lib/mysql/database_name) they are probably lost

One nice way to protect is the mysqldump
utility
documented in the mysql manual (except that they do not stress enough that you normally need to call
it with --user=user_name --password=user_passwd)

This generates sql statements to create and populate all
statements. From a perl script backup may be done
via a system call, e.g.
system("mysqldump .... >backup-file.sql");
with a number of defensive twists if something goes wrong. Hope this helps

svar
 
I checked the directory where the MySQL databases are stored, and they exist, MySQL just wasn't reconizing them as being there, giving me errors when I tried to connect to them. 10 minutes after I posted though, the problem corrected itself and MySQL is working fine. Any idea what would cause this?

Thanks for the tip about mysqldump, this little incident has scared me enough to start making backups of my work regularily.
 
hard to say what was wrong. Probably not just mysql
had problems. Can you look at /var/log/messages?

svar
 
Nothing unusual in the logs, just repetative messages from the cron daemon. I just glanced at most of the boot-up sequence though, since mysql was ended before I shut down and doesn't start until I manually run safe_mysqld. Should I go over those more carefully?
 
You may have something in /etc/boot.msg
but I am not sure if this will tell you anything;

in general you shopuld be happy if nothing was lost:)

svar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top