LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 05-28-2008, 02:58 PM   #1
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Rep: Reputation: 32
Recovering a Mysql Database after Crash


Hi All,
Our development group set up a Linux box about ten years ago to first serve as a print server and snad box for us to play with linux. Over time we have relied more on this system and use it as a web server, samba server, PDF generator and a bug tracker.
Well after a power outage the machine will no longer boot. We've tried everything we can think of and have decided it was time for a new machine anyway. I have switched to Ubuntu and have restored all functionality with the exception of our bug tracking db. It is a LAMP based system called MANTIS. I have the source files for Mantis. What I do not have is the Mysql database that it was tied to. I can access the hardrive that the database resided on via an Ubuntu live cd. Is there anyway to get to that data, back it up, and restore it on the new system?

Any info you provide will be much appreciated.

Thanks,

Chris
 
Old 05-28-2008, 03:51 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,624

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
If you can get to the old /var/spool/mysql directory, grab everything from there, and put it in the same location on your new system. Pray that it's readable, and not corrupted.

If you don't find that directory, check your mysql config on the old box, to tell you where the directory was, and put it back on the new server in the same place. If you have a mysql dump of the old database, that's even better, and can be restored very quick.

Good luck.
 
Old 05-29-2008, 06:57 AM   #3
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
Thanks TB0ne.
I'll give it a shot and report back.

Chris
 
Old 05-30-2008, 09:49 AM   #4
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
TB0ne,
Thanks. That worked perfectly. I didn't realize it would be that simple.

Chris
 
Old 05-30-2008, 10:38 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,624

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by cmfarley19 View Post
TB0ne,
Thanks. That worked perfectly. I didn't realize it would be that simple.

Chris
You're very welcome. And it's a crap shoot if that works or not. One little file inconsistency, and the database won't come back up.

FWIW, I'd either go through mysql-administrator (GUI utility, very nice if you've never used it), and schedule daily database backups, to some other system. You can also use mysql-dump, and CRON that, to grab a good snapshot of your database(s). Even if you put the backup files on the same system, you can always copy them off to your workstation, or move them somewhere else, just in case. The copy-trick doesn't always work.
 
Old 05-30-2008, 10:58 AM   #6
cmfarley19
Member
 
Registered: Nov 2002
Location: Central VA
Distribution: Ubuntu/Debian
Posts: 228

Original Poster
Rep: Reputation: 32
I only copied the single database folder that I needed.

I did setup a cron job to run mysqldump on all of our key databases. This used to get done regularly but for some reason around January the back ups were stopped.
The cron jobs dump the backups out to our network.

Thanks again for the advice.

Chris
 
Old 11-28-2009, 11:45 PM   #7
Chili.Willy
LQ Newbie
 
Registered: Jul 2007
Location: Stevens Point, Wisconsin, USA
Distribution: Debian Bookworm, Raspbian. Also Mint, SliTaz, Sparky, Xubuntu.
Posts: 28

Rep: Reputation: 1
cmfarley, I hope you might still find this OLD thread. You said
Quote:
I only copied the single database folder that I needed.
If I understand right, that's what I tried, but it isn't working.

I had a MySQL database called MyReferences to keep track of articles and books that I've read. I don't know how, but it's gone. I never made a real MySQL backup (with mysqldump or such), but I do have backups of all the files in the computer.

This is a Debian system, and the files that contain MySQL databases are in /var/lib/mysql/. There is no /var/spool/mysql as TB0ne referred to. I suppose they serve the same purpose.

On my backup system there is a copy of /var/lib/mysql/MyReferences/. I copied that directory into /var/lib/mysql/ on my active system. But after that, when I start MySQL and issue "show databases", MyReferences is not listed.

Any thoughts?? Thanks much.
Will
 
Old 11-29-2009, 12:02 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,624

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by Chili.Willy View Post
cmfarley, I hope you might still find this OLD thread. You said

If I understand right, that's what I tried, but it isn't working.

I had a MySQL database called MyReferences to keep track of articles and books that I've read. I don't know how, but it's gone. I never made a real MySQL backup (with mysqldump or such), but I do have backups of all the files in the computer.

This is a Debian system, and the files that contain MySQL databases are in /var/lib/mysql/. There is no /var/spool/mysql as TB0ne referred to. I suppose they serve the same purpose.

On my backup system there is a copy of /var/lib/mysql/MyReferences/. I copied that directory into /var/lib/mysql/ on my active system. But after that, when I start MySQL and issue "show databases", MyReferences is not listed.

Any thoughts?? Thanks much.
Will
Please open your own thread for your own question.

The directory can be specified in the MySQL config file, so /var/lib/mysql can probably be the same thing as the /var/spool/mysql, or anywhere else you set up MySQL to work. Check /etc/my.cnf, and look for the "datadir" directive...that's the directory you need to copy.

Again, see my previous post...this MAY or MAY NOT work...to be as close to 100% as you can, use a dump/backup tool.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
recovering from RAM crash stabu Slackware 2 05-23-2008 05:23 AM
Recovering MySQL database mohtasham1983 Linux - Server 5 02-25-2008 11:05 AM
Recovering a mysql database irvken Linux - Software 2 10-09-2005 05:27 PM
Recovering RAID-5 array after OS crash IMNOboist Linux - Hardware 0 12-14-2004 12:04 AM
Recovering Raid5 After Crash rspurlock Linux - Hardware 1 08-19-2003 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration