MySQL database backup and recovery methods, mysql Database Backup

Source: Internet
Author: User
Tags import database mysql command line

MySQL database backup and recovery methods, mysql Database Backup
MySQL database backup and recovery methods


Mysql-uroot-p
Show databases;




1. Export the database
1). MySQL command line to export the entire database (including data)
The exported files are stored in the mysql \ bin directory by default.
Mysqldump-u username-p Database Name> exported file name
Mysqldump-uroot-p123456 database_name> outfile_name. SQL


2). Export a table from the MySQL Command Line
Mysqldump-u user name-p database name Table Name> exported file name
Mysqldump-u user_name-p database_name table_name> outfile_name. SQL


3). Export a database structure from the MySQL Command Line
Mysqldump-u user_name-p-d-add-drop-table database_name> outfile_name. SQL
-D no data-add-drop-table add a drop table before each create statement


4). Export with language Parameters
Mysqldump-uroot-p-default-character-set = latin1-set-charset = gbk-skip-opt database_name> outfile_name. SQL


5) Back up multiple MySQL databases at the same time


Mysqldump-hhostname-uusername-ppassword-databases databasename1 databasename2 databasename3> multibackupfile. SQL




2. Import Database
1) run the mysqldump command:
Mysqldump-u user_name-p <outfile_name. SQL


2) use the source command
Mysql-uroot-p
Use databasename;

Source outfile_name. SQL


-------------------------------------

Dylan Presents.


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.