scp – Copy files to another server in SSH

Say you need to replicate a huge MySQL database to another machine and dumping and import the database might take hours, copy the binary files (/var/lib/mysql/DB_NAME) might be a quicker method. To do that, we can use scp:

s1# scp -P SSH_PORT /var/lib/mysql/DB_NAME/ user@s2:/var/lib/mysql/DB_NAME/

You would also need to chmod (644) & chown (mysql:mysql) the files on the destination server so MySQL server can read them properly.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *