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.

Problem moving database directories to a new server

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

  1. kray

    kray Member

    Joined:
    Mar 30, 2012
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    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 ?
     
    #2 corporatehost, Aug 23, 2014
    Last edited: Aug 23, 2014
  3. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Please try running /scripts/update_db_cache and see if the accounts re-appear in cPanel
     
Loading...

Share This Page