LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 02-12-2008, 10:38 AM   #1
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 652

Rep: Reputation: 33
rebuilding mysql data files


I had a HDD failure so ordered a new one and waiting for it to come in. My mySQL databases were on there (data files) so I'm just wondering how to go about rebuilding them once I install the new drive. I have a .sql backup dump of the entire DBs, but not sure how it will work to recreate the data files, since those also contain the root password and such. I probably should have backed up those as well right?
 
Old 02-13-2008, 07:16 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 3,978

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Do you mean with .sql files the output of the mysqldump command?

If so, did you dump all databases at once or not? If not, you'd have to create the databases manually (just "create database", no tables). Run the mysql command
Code:
mysql -u user -ppass < mydump.sql
and the database will be filled with the tables.

If you created the backup with --all-databases, you'd probable just have to run the mysql command once and the databases are created.

The users and grants is more difficult: those are kept in the mysql database. If you didn't backup that one either individually or with all-databases you have to create all accounts again.

(I realize now that this is my situation as well... hmm I should do something about that)

Be careful with the mysql version you use. 4.n and 5.0 are *not* compatible on the mysqldump level. You have to convert the databases first. It does not work to read 4.n dumps into 5.0. You should install the same version first and then upgrade.

jlinkels
 
Old 02-13-2008, 10:38 PM   #3
Red Squirrel
Member
 
Registered: Dec 2003
Distribution: FC9 on main server
Posts: 652

Original Poster
Rep: Reputation: 33
I just figured it out, I was making it more complicated then needed. When you fire up mysql, it actually generates the basic schema if it does not exist. So I should be good now, DBs are restoring.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reiserfsck stops when rebuilding tree at 50% - trying to recover deleted data vangelis Linux - Software 6 10-23-2006 12:34 PM
Extracting MySQL data from raw files cs-cam Linux - Software 1 06-12-2006 11:22 PM
rebuilding dovecot beta src.rpm with mysql 5 error dtra Linux - Software 0 05-08-2006 07:07 AM
Where to place mysql data files TaaDow Linux - Newbie 2 01-04-2006 11:46 PM
rebuilding cyrus-sasl src.rpm w/mysql support fails willwrk4u Red Hat 1 04-17-2004 02:34 PM


All times are GMT -5. The time now is 07:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration