The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restoring a backup

Discussion in 'Data Protection' started by spyderman4g63, Aug 10, 2008.

  1. spyderman4g63

    spyderman4g63 Registered

    Joined:
    Mar 3, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I have a full backup off site that. I am trying to restore 1 user account through the Web Host Manager.

    I separated the user file and uploaded it to my servers home dir. Ran the restore single user option in WHM and it restored my home directory, but not my MySQL databases.


    I talked to my buddy who setup the backups and he said that there was an option to break down the mysql backups by site and he chose not to do that. So he believes thatw e would have to do a full restore to get the 1 site back up.

    Is that true that the backups for databases fr all sites would not be broke down in the sites username folder?
    I noticed that there is a mysql folder in the user.tar.gz file, but it is empty.

    Is there anyway to split the DB backup if I can find it so that I can restore just one account?

    I am afraid to do a full restore because I don't want to risk bringing down my other users sites. If I do have to do a full backup, is there a way I can verify that the mysql data is in the backup file before I attempt this?
     
  2. UBERHOST

    UBERHOST Well-Known Member

    Joined:
    Jan 13, 2008
    Messages:
    102
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    California, US
    If everything is good except for the MySQL database(s) then you can use phpMyAdmin on the origin machine to export each db, then create an empty db using cPanel on the destination server, then open phpMyAdmin and import the db.

    The best method, however, is to go into shell on each machine and do the following, first on the old server:

    mysqldump --opt -u user_name -p user_dbname > filename.sql
    (you'll be prompted for the db user's password)

    Transfer the SQL file to the new machine, create an empty MySQL db, then enter:

    mysql -u user_name -p user_dbname < filename.sql
    (you'll be prompted for the db user's password)

    If you do not want to do it that way, then delete the cPanel account on the new server, and transfer it using

    Main >> Transfers >> Copy multiple accounts/packages from another server

    Make sure both servers are running WHM 11.23+ (most reliable transfers) and fill in the required information. Account Copier will pull a list of accounts from the origin machine, but you only need to transfer the one account you want. If the Package has not been setup on the new server, you can transfer that as well. This function will reliably set up the account on the new server with all databases intact. Once done, just check the DNS zone to make sure it reflects the proper records, and edit if necessary.

    HTH,
    Rick
     
  3. spyderman4g63

    spyderman4g63 Registered

    Joined:
    Mar 3, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I only have 1 server and the original database was destroyed. All I have now is the full backup form cpanel.
     
  4. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    In this case you can look on your remote storage for the "mysql" directory file. I assume this would be a compressed file called dirs.

    Anyway, grab that file and unpack it so you can view the mysql directory called:
    _var_lib_mysql_

    Once inside there, you can simply find the account you need and copy that over to your live /var/lib/mysql directory.

    Don't forget to change the ownership to mysql.mysql and double check the permissions.

    Outside of the remote backups, I would still suggest keeping a local copy of your backups on hand if you have the space.
     
  5. spyderman4g63

    spyderman4g63 Registered

    Joined:
    Mar 3, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    The MySQL folder for this user is empty. Is there something I need to change in WHM to have the backup include a MySQL backup in the future?

    For this site I am just going to start form scratch. I was a new site, but I didn't want to lose a weeks worth of work, but it looks like that is what I will have to do.

    As for the remote storage, this is actually a quad core server that my partner hosts at his house. I can also have the backups go to my local ftp. I just want to make sure that I have the MySQL data if one of our large sites goes down.
     
  6. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    You would want to look at the backup configuration:

    whm > backup > configure backup

    and check the radio button for:
    Per Account and Entire MySQL

    Since your remote storage is a friendly area and not NAS, you should consider creating local incremental backups and simply rsync the data to the remote location. This would save a lot of cpu time and bandwidth by not packing and over writing every account daily.

    Only changed files will be backed up and not entire accounts after you run the initial backup.
     
Loading...

Share This Page