SOLVED Restoring MySQL Databases Question

Musthafa

Member
Dec 14, 2016
17
0
1
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
 

SysSachin

Well-Known Member
Aug 23, 2015
604
48
28
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
 
  • Like
Reactions: cPanelMichael