This is a handy command that i use to backup or export, compress and upload a mysql database to my remote host, very handy when you wanna upload your development database to the remote host after some changes.
/usr/mysql/bin/mysqldump --opt -uUsername -pPassword Databasename | gzip -c | ssh -q firstname.lastname@example.org 'cat > ~/Databasename.sql.gz'
Replace the following :
- /usr/mysql/bin/mysqldump : The path for mysqldump on your localmachine
- Username : Username for local mysql database.
- Password : Password for local mysql database.
- Databasename : Name of the database to export.
- email@example.com : the user and the IP or the address of the remote host.
the above command will upload the compressed database to your home directory on the remote host, to change the directoy, replace ~/ with the path you want.