Secure transfer of database to another server (scp)

Once you have taken a mysql dump you may want to transfer this to another server. You can do this using scp (secure copy).

scp [database name].sql [username]@[servername]:path/to/database/

Example:

scp dbdump.sql [email protected]:~/

The example above securely copies the db to the server x.x.x.x and places the file in the root directory. (note: you will need to enter the password for the destination user/server)

scp custom port (example 666):

scp -P 666 filename.sql [email protected]:/