HostOnNet Blog

mysqldump

mysqldump command is used to take MySQL backup.

Take Backup of All databases

To take backup of all Databases on a MySQL server, run

mysqldump --all-databases > mysql_all_dbs.sql

Take Backup of a MySQL Database

To take Backup of a MySQL Database, run

mysqldump DB-NAME-HERE > DB-NAME-HERE.sql

Restoring Backup Taken with mysqldump

mysql DB-NAME-HERE < MYSQLDUMP_BACKUP_FILE.sql

Forcing mysqldump

You can use –force option to force mysqldump backup that will ignore sql errors, by default backup fail if there is error in dumping a table.

mysqldump --force DB-NAME > DB-NAME.sql

Posted in MySQL