MySQL database structure and data export and import using LAMP strategy (1)

Source: Internet
Author: User

 

Figure-LAMP

LAMPInsideMySQLThe database structure and data export and import operations are shown to you!

MySQL mysqldump is used for export. The basic usage is as follows:

Copy content to clipboard

PHP code:

 
 
  1. shell> mysqldump [OPTIONS] database [tables]  
  2.  

If you do not specify any tables, 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:

Copy content to clipboard

PHP code:

 
 
  1. --add-locks  
  2.  

Add lock tables and unlock table before each TABLE is exported. (To make it faster to insert data to MySQL ).

Copy content to clipboard

PHP code:

 
 
  1. --add-drop-table  
  2.  

Add a drop table before each create statement.

Copy content to clipboard

PHP code:

 
 
  1. --allow-keywords  
  2.  

Names of columns allowed to be created as keywords. This is done by the table name prefix on each column name.

Copy content to clipboard

PHP code:

 
 
  1. -c, --complete-insert  
  2.  

Use the complete insert Statement (with the column name ).

Copy content to clipboard

PHP code:

 
 
  1. -C, --compress  
  2.  

If both the client and server support compression, all information is compressed between the two.

Copy content to clipboard

PHP code:

 
 
  1. --delayed  
  2.  

Use the insert delayed command to INSERT rows.

Copy content to clipboard

PHP code:

 
 
  1. -e, --extended-insert  
  2.  

Use the new multiline INSERT syntax. (A more compact and faster insert statement is provided)

Copy content to clipboard

PHP code:

 
 
  1. -#, --debug[=option_string]  
  2.  

Tracking Program usage (for debugging ).

Copy content to clipboard

PHP code:

 
 
  1. --help  
  2.  

Displays a help message and exits.

Copy content to clipboard

PHP code:

 
 
  1. --fields-terminated-by=...  
  2.  
  3. --fields-enclosed-by=...  
  4.  
  5. --fields-optionally-enclosed-by=...  
  6.  
  7. --fields-escaped-by=...  
  8.  
  9. --fields-terminated-by=...  
  10.  

These options are used with-T options and have the same meaning as the load data infile clause.

Copy content to clipboard

PHP code:

Load data infile syntax

 
 
  1. -F, --flush-logs  
  2.  

Wash Out the log files on the MySQL server before starting the export.

Copy content to clipboard

PHP code:

 
 
  1. -f, --force,  
  2.  

Even if we get an SQL error while exporting a table, continue.

Copy content to clipboard

PHP code:

 
 
  1. -h, --host=..  
  2.  

Export data from the MySQL server on the named host. The default host is localhost.

Copy content to clipboard

PHP code:

 
 
  1. -l, --lock-tables.  
  2.  

Lock all tables for start export.

Copy content to clipboard

PHP code:

 
 
  1. -t, --no-create-info  
  2.  

Create table statement)

Copy content to clipboard

PHP code:

 
 
  1. -d, --no-data  
  2.  


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.