Mysqldump Backup and Recovery database

Source: Internet
Author: User
Tags sql error mysql command line

Backing Up the database

Mysqldump-u Root-plvtao Test >/home/bak.sql

Database restore, Common source command
Landing

Mysql-u root-p
MySQL> use testmysql>/home/Bak.sql

Common options:
--all-databases,-A: Backing Up all databases
--databases,-B: For backing up multiple databases, if there is no option, Mysqldump takes the first name parameter as the database name, followed by the table name. With this option, Mysqldum takes each name as the database name.
--force,-F: Continue backup even if a SQL error is found
--host=host_name,-H host_name: Backup host name, localhost by default
--no-data,-D: Export table structure only
--password[=password],-p[password]: password
--port=port_num,-P Port_num: Port number when making TCP/IP connections
--quick,-Q: Quick Export
--tables: Overwrite--databases or-b option, followed by parameter is considered as table name
--user=user_name,-u user_name: User name
--xml,-X: Export as XML file

Backup section

1. Back up the data and structure of all databases

- - - > F:\all. sql

2. Backing up the structure of all databases (plus-d parameter)

- - - A-D>F:\all_struct.sql


3. Backing up data from all databases (plus-t parameters)

- - - A-t>F:\all_data.sql

4. Backing up the data and structure of a single database (, database name MyDB)

-uroot-p123456 mydb>F:\mydb.sql

5. Backing up the structure of a single database

- -p123456 mydb-D>F:\mydb.sql


6. Backing up data from a single database

- -p123456 mydb-t>F:\mydb.sql

7. Backup multiple tables of data and structure (data, the structure of a separate backup method and the same)

- -p123456 mydb T1 T2>f:\multables.sql

8. Back up multiple databases at a time

- - -- databases DB1 db2>f:\muldbs.sql

Restore section: (1) MySQL command line source method and (2) system command line method

1. Restore all databases:
(1) MySQL command line:

MySQL>source f:\all. sql

(2) System command line:

- - <f:\all. sql

2. Restore a single database (Specify a database)
(1) MySQL command line:

MySQL> use mydbmysql>source F:\mydb.sql

(2) System command line:

- - <F:\mydb.sql

3. Restore multiple tables for a single database (Specify a database)

(1) MySQL command line:

MySQL> use mydbmysql>source F:\multables.sql

(2) System command line:

- -p123456 mydb<f:\multables.sql

4. Restore multiple databases (a backup file with multiple databases, no database required at this time)
(1) MySQL command line:

MySQL>source F:\muldbs.sql

(2) System command line:

- -p123456<f:\muldbs.sql

Mysqldump Backup and Recovery database

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.