Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 02-12-2008, 11:38 AM   #1
Red Squirrel
Senior Member
Registered: Dec 2003
Distribution: Mint 17.1 KDE on workstation, CentOS 6.x on servers
Posts: 1,121

Rep: Reputation: 46
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, 08:16 PM   #2
Senior Member
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,707

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
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
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.

Old 02-13-2008, 11:38 PM   #3
Red Squirrel
Senior Member
Registered: Dec 2003
Distribution: Mint 17.1 KDE on workstation, CentOS 6.x on servers
Posts: 1,121

Original Poster
Rep: Reputation: 46
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.


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

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 01:34 PM
Extracting MySQL data from raw files cs-cam Linux - Software 1 06-13-2006 12:22 AM
rebuilding dovecot beta src.rpm with mysql 5 error dtra Linux - Software 0 05-08-2006 08:07 AM
Where to place mysql data files TaaDow Linux - Newbie 2 01-05-2006 12:46 AM
rebuilding cyrus-sasl src.rpm w/mysql support fails willwrk4u Red Hat 1 04-17-2004 03:34 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:47 AM.

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