Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Problem moving database directories to a new server

Discussion in 'Database Discussion' started by kray, Aug 22, 2014.

  1. kray

    kray Member

    Joined:
    Mar 30, 2012
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    MySQL broke on my old server so I copied all the directories in /var/lib/mysql to the same location on my new server and recursively set owner and group to mysql with permissions of 0755 and restarted mysql. I expected to see the databases and users when I logged into the corresponding accounts via cpanel but they aren't there. Where did I go wrong?
     
  2. corporatehost

    corporatehost Member

    Joined:
    Jul 17, 2014
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi Kray,

    Did you try mysqldump ?

    At your old server, perform the following command

    # mysqldump --all-databases > all-databases-backup.sql

    This shouldn't generate any error. The above command just takes all your databases in a SQL Format and saves it in a file name all-databases-backup.sql

    Once finished, rsync or scp to your new server at any location and restore the database to your new server.

    # mysql < all-databases-backup.sql

    I recommend doing these in the screen mode if you contain more databases in your server.


    What errors do you get in your /var/lib/mysql/<hostname.err> file at your old server ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 corporatehost, Aug 23, 2014
    Last edited: Aug 23, 2014
  3. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    575
    Likes Received:
    20
    Trophy Points:
    93
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Please try running /scripts/update_db_cache and see if the accounts re-appear in cPanel
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice