Export and Import Tools of MySQL Data: MySQLDUMP

zhaozj2021-02-16  47

Yiz: http://www.yiz.nameyizblog: http://blog.yiz.name

Export to use MySQLDUMP tools, basic usage is: shell> mysqldump [options] Database [Tables] If you do not give any table, the entire database will be exported. By performing mysqldump --help, you can get the option table for your MySQLDUMP's version support. Note that if you run mysqldump no --quick or --opt option, mysqldump will load the entire result set to memory before the export result, if you are exporting a large database, this will might be a problem. MySQLDUMP supports the following options: --Add-Locks Add Lock Tables before each table exported and then UNLOCK TABLE. (In order to make it faster into mysql). - ADD-DROP-TABLE adds a DROP TABLE before each CREATE statement. - Allow-Keywords allows you to create column names for keywords. This is died by the table name. -C, --Complete-INSERT uses 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 inserts the line with the insert delayed command. -E, --Extended-INSERT uses a new multi-line INSERT syntax. (Give a more tightening and faster plug-in statement) - #, --debug [= Option_string] Tracking 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 selection and have the same meaning of the corresponding Load Data INFILE clause. Load Data Infile syntax. -F, --flush-logs is washed away in the Mysql server before starting the export. -F, --force, even if we get a SQL error during a table, continue. -H, --host = .. exports data from the MySQL server on the named host. The default host is Localhost. -L, --LOCK-TABLES. To start exporting lock all tables. -T, --NO-CREATE-INFO does not write table creation information (CREATE TABLE statement) -d, - NO-DATA does not write any of the line information. If you just want to get the export of a table, it is very useful! --Opt with --quick -dd-drop-table --add-locks --extended-insert --lock-tables. Should be given to the fastest possible export of a MySQL server. -Pyour_pass, --password [= Your_pass] The password 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 when connecting to a host connection. (This is used to connect to hosts other than localhost because it uses UNIX sockets.

) -Q, --quick does not buffer query, export 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 that 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 When connecting to a server, the username used by MySQL. The default is your UNIX login name. -O var = option, --set-variable var = option Sets the value of a variable. Possible variables are listed below. -V, --verbose lengthy mode. Print out more information made by the program. -V, --Version prints version information and exits.

转载请注明原文地址:https://www.9cbs.com/read-20565.html

New Post(0)