MySQL mysqldump tool, basic usage

Source: Internet
Author: User

Mysqldump [Options] database [Tables] If you do not specify any table, the entire database will be exported. Run mysqldump -- help to obtain the option table supported by your mysqldump version. Note: If you run mysqldump without the -- quick or -- opt option, mysqldump loads the entire result set to the memory before the export result. If you are exporting a large database, this may be a problem. Mysqldump supports the following options: -- add-locks adds lock tables and unlock table before each table is exported. (To make it faster to insert data to MySQL ). -- Add-drop-table: Add a drop table before each create statement. -- Allow-keywords allows the creation of column names that are keywords. This is done by adding the table name before the column name. -C, -- complete-insert use the complete insert Statement (with the column name ). -C, -- compress: if both the client and server support compression, compress all information between the two. -- Delayed use the insert delayed command to insert rows. -E, -- extended-insert use the new multiline insert syntax. (A more compact and faster insert statement is provided)-#, -- debug [= option_string] use of the tracing program (for debugging ). -- Help: displays a help message and exits. -- Fields-terminated-by =... -- fields-enclosed-by =... -- fields-optionally-enclosed-by =... -- fields-escaped-by =... -- fields-terminated-by =... these options are used with-T options and have the same meaning as the load data infile clause. Load data infile syntax. -F, -- flush-logs: wash the log files on the MySQL server before export. -F, -- force, even if we get an SQL error during the export of a table, continue. -H, -- Host = .. export data from the MySQL server on the named host. The default host is localhost. -L, -- lock-tables. Lock all tables for export start. -T, -- no-create-Info does not write the table creation Information (create table statement)-D, -- no-data does not write any row information of the table. If you only want to export the structure of a table, this is very useful! -- OPT is the same as -- quick -- add-drop-table -- add-Locks -- extended-insert -- lock-tables. You should be given the fastest export possible for reading a MySQL server. -Pyour_pass, -- password [= your_pass] indicates the password used to connect to the server. If you do not specify "= your_pass", mysqldump requires a password from the terminal. -P port_num, -- Port = port_num indicates the TCP/IP Port number used to connect to a host. (This is used to connect to a host other than localhost because it uses UNIX sockets .) -Q, -- quick does not buffer queries and is exported directly to stdout. Use mysql_use_result () to do it. -S/path/to/socket, -- socket =/path/to/socket the socket file used when connecting to localhost (it is the default host. -T, -- tab = path-to-some-directory create a table_name. SQL file for each given table, which contains the SQL CREATE command and a table_name.txt file, which contains data. Note: This only works when mysqldump runs on the same machine where the mysqld daemon is running .. The format of the TXT file is determined by the options -- fields-xxx and -- lines -- XXX. -U user_name, -- user = user_name: username used by MySQL 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. Possible variables are listed below. -V, -- verbose mode. Print out more information about the program. -V, -- version: print the version information and exit. -W, -- where = 'where-condition 'only exports the selected records. Note that the quotation marks are mandatory! "-- Where = user = 'jimf '" "-wuserid> 1" "-wuserid <1" the most common mysqldump may create a backup of the entire database: mysqldump -- opt database> backup-file. SQL but it is also useful for enriching the information from a database and another MySQL database: mysqldump -- opt database | MySQL -- Host = remote-host-C database because mysqldump exports a complete SQL statement, it is easy to use a mysql client program to import data: mySQL target_db_name <backup-file. SQL
Enter mysqldump-uroot-p123456 -- opt-B Database Name> bakname. SQL-uroot-p123456 In the MySQL \ bin directory under cmd. Do not enter spaces in the middle. 123456 is the password

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.