How to export mysql database and restore using SSH


 First login your server using SSH. Then run following command


mysqldump -u dbuser -p dbpassword dbname | gzip > dbname.sql.gz

Change dbuser, dbpassword and dbname with your database user name, password and database name.

domain registration

If you want to restore the database on another server. Then we need to copy exported database on another server. We can copy files using scp.


We need to run following command to copy using scp.


scp dbname.sql.gz root@secondserverip:


If you use custom port then you need to specify port.


scp -P 80 dbname.sql.gz root@secondserverip:


Now login your second server and run following command.


gunzip < database.sql.gz | mysql -u dbuser -p dbpassword dbname

Comments

Popular posts from this blog

Restart DNS Client Service Windows 10: Step By Step Guide

Comprehensive Guide to Domain Hosting Services in Pickering

Advance Server Bangladesh