[MySQL] Using mysqldump for text backup

Source: Internet
Author: User
Tags mysql backup
When using mysqldump to back up MySQL, the backup file is a text file in SQL format, which consists of a series of createtable and insert statements. To restore the SQL file

When using mysqldump to back up MySQL, the backup file is a text file in SQL format, which consists of a series of create table and insert statements. To restore the SQL file

When using mysqldump to back up MySQL, the backup file is a text file in SQL format, which consists of a series of create table and insert statements. When restoring, you only need to use the SQL file as the input of the mysql program, as shown below:

Mysqldump mydb mytbl> mytbl. SQL
Mysql mydb <mytbl. SQL

Note: do not try to use mysqlimport to load the backup file generated by mysqldump! Mysqlimport can only read data rows and cannot be used to read SQL statements.

When you press mysqldump in the command line without adding any parameters, the following message is displayed:

[Root @ lx203 ~] # Mysqldump
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] -- databases [OPTIONS] DB1 [DB2 DB3. ..]
OR mysqldump [OPTIONS] -- all-databases [OPTIONS]
For more options, use mysqldump -- help

The above prompts provide three usage methods. We will introduce them one by one:

1) mysqldump [OPTIONS] database [tables]

This is the most common method of use. It provides a database name and one or more table names after it, indicating to export the specified tables in the database.

2) mysqldump [OPTIONS] -- databases [OPTIONS] DB1 [DB2 DB3. ..]

The second method uses the -- databases parameter, which exports all the tables in the listed Database

3) mysqldump [OPTIONS] -- all-databases [OPTIONS]

The -- all-databases parameter indicates to export all tables in all databases, including permission tables in the mysql database. Therefore, be careful when using this parameter.

For more details, please continue to read the highlights on the next page:

Related reading:

Using mysqldump in Linux to back up a MySQL database as an SQL File

Use mysqldump in Linux to regularly back up MySQL Databases

Mysqldump missing-q Parameter causes MySQL to be killed by oom

Mysqldump and LVM logical volume Snapshot

MySQL backup solution --> (using mysqldump and binlog binary logs)

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.