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!

SOLVED Restoring MySQL Databases Question

Discussion in 'Database Discussion' 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:
    44,303
    Likes Received:
    1,847
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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:
    604
    Likes Received:
    42
    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
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
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