Tuesday, February 23, 2021

How to backup db from the remote server to your computer

 1) ssh to the remote server using command or putty credentials (hostname, username, password, port)

 eg:ssh production-host@ssh.clouduser

2) Change directory to /tmp

         eg: cd /tmp

3)create a backup using db command and  credentials(username, password, hostname)

 WHOLE DB back up

mysqldump -h database.hostname -u username -p dbname | gzip > filename.dbbckup.sql.gz 


ONLY TABLES back up

mysqldump -h database.hostname -u username -p dbname <table_1> <table_2> | gzip > filename.sql.gz

4)Download it to your local computer

In your local computer command line enter the following command

scp -r production-host@ssh.clouduser:/tmp/filename.dbbckup.sql.gz /home/path/Desktop/


No comments:

Post a Comment