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)