Use of mysqldump exported data in MySQL

Source: Internet
Author: User
Tags one table

Mysqldump Common parameter Description:

Help using: Mysqldump--help

-A,--all-databases export all Databases Mysqldump-uroot-p–a >/tmp/filename.sql-y,--all-tablespaces Export all table spaces-Y,--no-tablespace s does not export any tablespace information.--add-drop-database Add the DROP DATABASE statement before each database is created. --add-drop-table Add a Drop data table statement before each data table creation, default is on, and use the –skip-add-drop-table cancel option. --add-locks adds lock tables and then unlock table before each table is exported. The default is on, using the –skip-add-locks cancel option.-I,--comments additional comment information, default is open, can be used – Skip-comments Cancel.--compact Export less output information (for debugging). Remove the structure of annotations and Kinsoku.-C,--compress All information is enabled for compression between the client and the server-B,--databases exports multiple databases, all parameter names after the parameters are treated as database names. For example: Mysqldump-uroot-p-B Test Mysql--default-character-set Sets the default character set, and the default value is UTF8. For example: MYSQLDUMP-UROOT-P–A–DEFAULT-CHARACTER-SET=LATIN1-E,--events export event.-F,--flush-logs refresh log before starting export Note: If you export more than one database at a time ( Using the option –databases or –all-databases), the log will be refreshed one by one. In addition to using –lock-all-tables or –master-data
Outside In this case, the log will be refreshed once, so the table is locked at the same time. Therefore, if you intend to export and refresh the logs at the same time, you should use –lock-all-tables or –master-data and –flush-logs.
Mysqldump-uroot-p–all-databases–flush-logs-f,--force ignores the SQL errors that occur during the export process.--ignore-table=name does not export the specified table. Specifies that when multiple tables are ignored, you need to repeat them multiple times, one table at a time. Each table must specify both the database and the table name. -D,--no-data does not export any data, only the database table structure is exported. -P,--password[=name] connect database password-p,--port=# connect database port number-U,--user=name specify the user name of the connection. --debug-info output debug Information and exit-R,--routines export stored procedures and functions--triggers export trigger

Mysqldump is often used for database backup and restore, in the process of backup, we can add any of the above parameters according to their actual situation

1. Export the entire database (including the data in the database and the statement that created the table)

Mysqldump-u username-p dbname > Filename.sql

2. Export the database structure (without data, only the statements that create the table)

3. Export a data table (containing table data and creating table statements) in the database

Mysqldump-u username-p dbname tablename > Filename.sql

4. Export the table structure of a data table in the database (without data)

  

  

  

  

Use of mysqldump exported data in MySQL

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.