Home > Linux > mySQL backup / copy DB over SSH to remote host

mySQL backup / copy DB over SSH to remote host

Working with mysql on server, I need often to make quick backup od given db. Here is quick and dirty how to do it.
Some small mySQL copy/backup/dump command line for quick copy/paste.
Copying of whole database to another host.

mysqldump –opt dbname -u root -pXXXX | ssh -C root@10.0.0.0 “mysql -u root -pXXXX dbname

Backup (dump) of database to local drive.

mysqldump –opt dbname -u root –password=XXXXX | bzip2 > /backupOFdb_20100412.bz2

or backup with automatic date creation

mysqldump DBNAME -pPASSWORD | gzip > /mysqldump-`date +%A`.sql.gz

Categories: Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.

%d bloggers like this: