Results 1 to 2 of 2

Thread: How to restore MySQL data/setup?

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    132

    Default How to restore MySQL data/setup?

    I'm looking for some advice restoring the MySQL setup and databases from a backup after a total operating system restore (following a file system corruption).

    OS is RedHat 9 (original was 7.3 though). MySQL is 4.x, as the original was.

    Here's what I have from a backup (not a CPanel backup, done by another backup script):

    1) An .sql dump file for each "user" database.

    2) A mysql.sql dump file with what looks like the "system" database, user etc info.

    3) A database.sql dump file containing only:

    -- MySQL dump 9.09
    --
    -- Host: localhost Database: Database
    ---------------------------------------------------------
    -- Server version 4.0.15-standard

    My questions are:

    a) How best to go about restoring the MySQL system info and databases without danger of a screwup.

    b) What order should I restore things in? "User" data first, or the mysql.sql?

    c) Do I need the database.sql file?

    I'm ok with how to import a dump file using:

    mysql -uUSERNAME -pPASSWORD newdbname < /path/to/dump.sql

    but AFAIK the database must have been created first?

    Any advice very welcome!

  2. #2
    Member
    Join Date
    Aug 2001
    Posts
    132

    Default

    No pearls of wisdom then?

    If anyone's interested, here's what I did:

    1. Created a new databse called newmysql.

    2. Imported the sql dump file mysql.sql into this database:

    mysql -uUSERNAME -pPASSWORD newmysql < /path/to/mysql.sql

    3. Stopped mysql, then copied the (newly created) files from the newmysql database directory into the /var/lib/mysql/mysql directory.

    4. Restarted mysql.

    This got me the usernames and passwords back.

    For the individual databases I created each one (mysql at the shell prompt and then CREATE DATABASE databasename; ). Then imported the dump file using the command in 2 above with the relevant database name etc.

    This seems to have worked fine. There is probably a much easier way, but the job got done.

Similar Threads

  1. Website hacked. how to restore data
    By yogesh_gamer in forum New User Questions
    Replies: 0
    Last Post: 04-30-2011, 03:15 AM
  2. How to restore Email Data of Cpanel manually
    By nabendumaji in forum Data Protection
    Replies: 2
    Last Post: 05-29-2010, 09:35 AM
  3. Replies: 2
    Last Post: 05-28-2005, 08:28 AM
  4. I want to restore backup data in a new WHM install
    By host2please in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 02-11-2005, 05:03 AM
  5. How Do I Restore MySQL data from a Full Site Backup?
    By StealthDesign in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 11-08-2003, 11:31 AM