LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 02-12-2008, 10:38 AM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
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
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

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



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 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:18 PM.

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