$> mysqldump -u DB_USER --password=DB_PASSWORD -h DB_HOST DB_NAME > FILENAME.sql
To compromise (gzip) the output:
$> mysqldump -u DB_USER --password=DB_PASSWORD -h DB_HOST DB_NAME | gzip -9 > FILENAME.sql.gz;
Usefull Params
- –single-transaction
- –quick
- –opt
Export all Databases
$> mysqldump -uroot -p -quick --all-databases --skip-lock-tables | gzip -9 > all_dbs.sql.gz;
Through an ssh tunnel
$> ssh user@host "mysqldump -u DBUSER -pPASSWORD db | gzip -9 -c" > ~/PATH/TO/dump.sql.gz