Inverted structure and data from MySQL database and table _ MySQL

Source: Internet
Author: User
Tags sql error
From the MySQL database and table inverted structure and data utility, for backup or to transfer data to another SQL Server dumping a database or many databases. Dumping contains SQL statements used to create or enrich a table. Shellmysqldump [OPTIONS] database [tables] if you do not specify any table, the whole database will be dumped. Execute mysqld to pour out the structure and data utility from the MySQL database and table, dumping a database or many data libraries for backup or data transfer to another SQL Server. Dumping contains SQL statements used to create or enrich a table.
  
Shell> mysqldump [OPTIONS] database [tables]
  
If you do not specify any tables, the entire database will be dumped.
  
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 dumping the results. if you are dumping a large database, this may be a problem.
  
   Mysqldump supports the following options:
-- Add-locks
Add lock tables and unlock table before each TABLE is dumped. (To make it faster to insert data to MySQL ).
  
-- Add-drop-table
Add a drop table before each create statement.
-- Allow-keywords
Names of columns allowed to be created as keywords. This is done by the table name prefix on each column name.
-C, -- complete-insert
Use the complete insert statement (with the column name ).
-C, -- compress
If both the client and server support compression, all information is compressed 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]
Tracking program usage (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 dumping.
-F, -- force,
Even if we get an SQL error while a table is dumped, continue.
-H, -- host = ..
Dumping data from the MySQL server on the named host. The default host is localhost.
-L, -- lock-tables.
Lock All tables for starting dumping.
-T, -- no-create-info
Create table statement)
-D, -- no-data
No row information is written to the table. This is useful if you only want to get a table structure dumped!
-- Opt
Same as -- quick -- add-drop-table -- add-locks -- extended-insert -- lock-tables. It should be the fastest way to read a MySQL server.
-Pyour_pass, -- password [= your_pass]
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
The TCP/IP port used to connect to a host. (This is used to connect to a host other than localhost because it uses Unix sockets .)
-Q, -- quick
If the query is not buffered, it is directly dumped 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 (which 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
The username used by MySQL to connect to the server. The default value 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
Lengthy mode. Print out more information about the program.
-V, -- version
Print the version information and exit.
-W, -- where = where-condition
Only the selected records are dumped. Note that the quotation marks are mandatory!
"-- Where = user = jimf" "-wuserid> 1" "-wuserid
  

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.