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.

SOLVED Restoring MySQL Databases Question

Discussion in 'Database Discussions' started by Musthafa, Dec 15, 2016.

Tags:
  1. Musthafa

    Musthafa Member

    Joined:
    Dec 14, 2016
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Dubai
    cPanel Access Level:
    Root Administrator
    Hi,

    I was trying to restore/sync all databases from server1 to server2 which has some more mysql users than the server2. Whenever I do the restoration, users which are not present in the server1 are getting deleted from the server2 Db.
    I am using this command to restore the Db " mysql -u root -p < DB_Sunday_2.sql "

    Will it overwrite the existing tables or append it? If it overwrites why there is change in size of files in /var/lib/mysql on both servers?
    -----------------------------------------------------------------------------------------
    mysql Ver 14.14 Distrib 5.6.34, for Linux (x86_64) using EditLine wrapper


    Any helps appreciated
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,281
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. Musthafa

    Musthafa Member

    Joined:
    Dec 14, 2016
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Dubai
    cPanel Access Level:
    Root Administrator
    Hi,

    How to take a complete db backup except one (say mysql)?
     
  4. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    542
    Likes Received:
    39
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Try with following command. Update your correct MySQL root password (-proot) in this command.

    Code:
    echo 'show databases;' | mysql -uroot -proot | grep -v ^Database$ | grep -v ^information_schema$ | grep -v ^mysql$ | xargs mysqldump -uroot -proot  --databases > all.sql
    
     
    cPanelMichael likes this.
Loading...

Share This Page