MySQL Import and Export tool mysqldump command detailed

Source: Internet
Author: User
Tags sql error mysql import

To export the Mysqldump tool to use with MySQL, the basic usage is:

Shell> mysqldump [OPTIONS] database [tables]

If you do not give any tables, the entire database will be exported.

By executing mysqldump--help, you can get a list of options supported by your mysqldump version.

Note that if you run mysqldump without the--quick or--opt option, mysqldump will load the entire result set into memory before exporting the results, which would probably be a problem if you are exporting a large database.

Mysqldump supports the following options:--Help Information--add-locks adds lock tables before each table is exported and then unlock table.    (To make it faster to insert into MySQL). --add-drop-table adds a drop table before each create statement. --allow-keywords allows you to create column names that are keywords.    This is done by prefixing the table name with each column name. -C,--complete-Insert uses the full INSERT statement (with the column name). -C,--Compress if both the client and the server support compression, compress all the information between the two. --delayed inserts a row with the insert delayed command. -E,--extended-Insert uses the new multiline insert syntax. (Give a more condensed and faster INSERT statement)-#,--debug[=option_string] Tracker usage (in order to debug). -F,--flush-logs before starting the export, wash the log files in the MySQL server. -F,--Force , even though we get a SQL error during the export of a table, continue. -H,--host=.. Export data from a MySQL server on a named host.    The default host is localhost. -L,--lock-tables.    Locks all tables for starting export. -T,--no-create-Infodo not write table creation information (CREATE TABLE statement)-D,--no-data does not write any row information for the table.    This is useful if you only want to export the structure of a table! --opt with--quick--add-drop-table--add-locks--extended-insert--lock-tables.    Should give you the fastest possible export for reading into a MySQL server. -pyour_pass,--password[=Your_pass] The password to use when connecting to the server. If you do not specify "=your_pass "section, Mysqldump requires a password from the terminal. -P Port_num,--port=port_num TCP used when connecting to a single host/IP port number. (This is used to connect to a host other than localhost because it uses a UNIX socket.) )-Q,--quick does not buffer queries, export directly to stdout; use Mysql_use_result () to do it. -s/path/to/socket,--socket=/path/to/Socket file used by the socket when connected to localhost (it is the default host). -T,--tab=path-to-some-directory for each given table, create a Table_name.sql file that contains the SQL create command, and a table_name.txt file that contains the data. Note: This only works when the mysqldump is running on the same machine as the mysqld daemon. The format of the. txt file is based on--fields-xxx and--lines--XXX option to set. -U user_name,--user=user_name The user name that MySQL uses when connecting to the server.    The default value is your UNIX login name. -O var=option,--set-variable var=option to set the value of a variable.    The possible variables are listed below. -V,--verbose verbose mode.    Print out more information that the program has done. -V,--version Prints the release information and exits. -W,--where='where-condition'only the selected records are exported; Note that the quotation marks are mandatory! "--where=user= ' JIMF '" "-wuserid>1" "-wuserid<1"   

MySQL Import and Export tool mysqldump command detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.