mysqldump
The mysqldump client is a backup program. It can be used to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump contains SQL statements to create the table or populate it, or both.[1]
Documentation
- man 1 'mysqldump' [EN]
Syntax
mysqldump [PARAMETER ...] DATABASE [TABLE ...]
mysqldump [PARAMETER ...] --databases DATABASE [DATABASE ...]
mysqldump [PARAMETER ...] --all-databases
Parameters
- --add-drop-database
- Add a DROP DATABASE statement before each CREATE DATABASE statement.
- --add-drop-table
- Add a DROP TABLE statement before each CREATE TABLE statement.
- -A, --all-databases
- Dump all tables in all databases. This is the same as using the --databases option and naming all the database on the command line.
- -B DATABASE [...], --databases DATABASE [...]
- Dump several DATABASEs. Normally, mysqldump treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names. CREATE DATABASE and USE statements are included in the output before each new database.
- --create-options
- Include all MySQL-specific table options in the CREATE TABLE statements.
- -C, --compress
- Compress all information sent between the client and the server if both support compression.
- -p[PASSWORD], --password[=PASSWORD]
- The PASSWORD to use when connecting to the server. If you use the short option form (-p), you cannot have a space between the option and the password. If you omit the password value following the --password or -p option on the command line, you are prompted for one.
- -u USER, --user=USER
- The MySQL USER to use when connecting to the server.
Examples
- Dump all databases from 'localhost'
mysqldump --all-databases > 'all_databases.sql'
References
- ↑ man 1 'mysqldump'