Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Jul 2003
    Posts
    7

    Default how to restore sql from slave disk

    I had to change disk because of sector problem and got a new disk. old disk is mount as slave so i could copy the files from old on.
    Question is how can i restore/make a sql dump of that sql db to customers from old disk when i not can do that from phpmyadmin or cpanel when i only can list the file like this
    -rw-rw---- 1 mysql mysql 1024 Jan 6 16:22 ibf_statistics.MYI
    -rw-rw---- 1 mysql mysql 8736 Jan 6 16:21 ibf_subscription_currency.frm
    -rw-rw---- 1 mysql mysql 0 Jan 6 16:21 ibf_subscription_currency.MYD
    -rw-rw---- 1 mysql mysql 1024 Jan 6 16:21 ibf_subscription_currency.MYI
    -rw-rw---- 1 mysql mysql 8826 Jan 6 16:21 ibf_subscription_logs.frm
    etc.

  2. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    So long as those files have not been created/updated already in the live location, you should be able to do the following:

    service chkservd stop
    service mysql stop
    cd /var/lib
    mv mysql mysql.orig
    cp -avf /yourslavedisk/var/lib/mysql ./
    service mysql start
    service chkservd start


    If that breaks things you can stop mysql again and mv mysql out of the way again and mv mysql.orig back to mysql.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Oct 2003
    Location
    seattle
    Posts
    50

    Default

    I know this is a very old post, but it really saved my backside today when I had a primary drive crash and had to restore from backups. To my horror, I discovered that cPanel backup had somehow been switched to "mysql dir only" and the restoration process failed to generate the customer's OsCommerce database, resulting in thousands of unhappy customers and one VERY unhappy client. Fortunately, my research brought me to this thread. Thanks Chirpy. You're my hero

    I'd like to add a couple of lines though because the original doesn't take file ownership into account and also doesn't mention that cPanel sometimes generates TWO MySQL backup directories with very different information within - one with and one without a trailing underscore. In my situation, the directory with the underscore was the correct one. This assumes that your backups have the same path as mine and you are restoring from daily backups.

    service chkservd stop
    service mysql stop
    cd /var/lib
    mv mysql mysql.orig
    cp -avf /backup/cpbackup/daily/dirs/_var_lib_mysql_ mysql
    chown -R mysql:mysql mysql # this is where the magic happens
    service mysql start
    service chkservd start

    The file ownership issue caused me a half hour of spinning my wheels until I noticed it. Hopefully this post will save the next guy a few minutes
    wwww.themothership.net
    Webhosting for Musicians

Similar Threads & Tags
Similar threads

  1. Server restore + Slave hard dirve
    By mahdionline in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 02-01-2011, 10:39 PM
  2. Hacked Server - copy sql from slave
    By webvision in forum Database Discussions
    Replies: 3
    Last Post: 11-13-2007, 10:56 PM
  3. Hacked Server - copy sql from slave
    By webvision in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 11-13-2007, 10:56 PM
  4. how to restore sql from slave disk
    By Norcomp in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-04-2007, 01:34 AM
  5. Restoring off a mounted slave disk
    By snet in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-08-2005, 01:56 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube