A utility that dumps a database or multi-database for backup or transferring data to another SQL server. Drop will contain the SQL statement that creates a table or a full table.
Shell> mysqldump [options] Database [TABLES]
If you don't give any table, the entire database will be poured.
By performing mysqldump --help, you can get the option table for your MySQLDUMP's version support.
Note that if you run mysqldump without --quick or --opt option, MySQLDUMP will load the entire result set to memory before the resulting result, if you are pouring a big database, this may be a problem.
MySQLDUMP supports the following options:
--Add-Locks
Add Lock Tables before each table is poured and UNLOCK TABLE. (In order to make it faster into mysql).
-dd-drop-table
Add a DROP TABLE before each CREATE statement.
- Allow-Keywords
Allow creation is a column name of the keyword. This is died by the table name.
-c, --complete-insert
Use a complete INSERT statement (with column name).
-C, --compress
If both the customer and the server support compression, compress all information between the two.
-delayed
Insert with the insert delayed command.
-e, --extended-insert
Use a new multi-line INSERT syntax. (Give more tightening and faster insert statements)
- #, --debug [= Option_String]
Tracking the usage (for debugging).
--help
Display a help message and exit.
--fields-terminated-by = ...
--fields-enclosed-by = ...
--fields-optionally-enclosed-by = ...
--fields-escaped-by = ...
--fields-terminated-by = ...
These options are used with -t selection and have the same meaning as the corresponding Load Data INFILE clause. See 7.16 Load Data Infile syntax.
-F, --flush-logs
Wash the log file in the MySQL server before starting pouring.
-f, --force,
Even if we get a SQL error during a form, continue.
-h, --host = ..
Dump data from the MySQL server on the named host. The default host is Localhost.
-L, --Lock-Tables.
To start dumping all tables.
-T, --NO-CREATE-INFO
Do not write table creation information (CREATE TABLE statement)
-D, --NO-DATA
Do not write any of the rows of information. If you just want to get the dump of a table, it is useful!
--opt
With --quick --add-drop-table --add-locks --extended-insert --lock-tables. You should give you as fast as possible to read a MySQL server.
-pyour_pass, --password [= Your_pass]
Passwords used when connecting to the server. If you don't specify a "= Your_Pass" section, MySQLDUMP needs a password from the terminal.
-P port_num, --port = port_num
The TCP / IP port number used in connection with a host. (This is used to connect to hosts other than localhost because it uses UNIX sockets.)
-q, --quick
Do not buffer query, dump directly to stdout; do it using mysql_use_result ().
-S / path / to / socket, - Socket = / path / to / socket When connecting to localhost (it is the default host).
-T, - Tab = path-to-some-directory
For each given table, create a table_name.sql file, which contains the SQL CREATE command, and a table_name.txt file, which contains data. Note: This only works when MySQLDUMP is running on the same machine in MySQLD daemon. The format of the .txt file is based on the Fields-XXX and --Lines - XXX options.
-U user_name, --user = user_name
Usernames used by MySQL when connecting to the server. The default is your UNIX login name.
-O var = Option, --set-variable var = Option
Set the value of a variable. Possible variables are listed below.
-v, --Verbose
Permutable mode. Print out more information made by the program.
-V, --version
Print version information and exit.
-w, --where = 'where-condition'
Only dumped the selected record; note the quotation marks forced!
"--where = user = 'jimf'" "" -wuserid> 1 "" -wuserid <1 "
The most common mysqldump uses a backup of the entire database:
MySQLDUMP --Opt Database> Backup-file.sql
But it is also useful to enrich another mysql database with information from a database:
MySQLDUMP --Opt Database | MySQL - Host = Remote-Host-C Database