docs:mysql:mysqldump

This is an old revision of the document!


mysqldump

text-based client for dumping or backing up mysql databases, tables, and or data.

mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --add-databases [OPTIONS]

The most normal use of mysqldump is probably for making a backup of whole databases. See Mysql Manual section 21.2 Database Backups.

mysqldump --opt database > backup-file.sql

Note: --opt is the same as: --add-drop-table --add-locks --all --extended-insert --quick --lock-tables

You can read this back into MySQL with:

mysql database < backup-file.sql

or

mysql -e 'source /path-to-backup/backup-file.sql' database

More options and examples are available in the man page and in the MySQL manual

  • docs/mysql/mysqldump.1186594040.txt.gz
  • Last modified: 2008/08/03 00:25
  • (external edit)