Mysql backup and recovery command in Windows

Source: Internet
Author: User
Tags import database
In Windows, I used the Navicat for mysql tool at the beginning to use the export/import database function in MySQL. However, some tables were lost after the export; so I thought of the command line.

The following is a command line backup and restoration method:

Set MySQL to disk c. the mysql database username is root, the password is 123, and the database name is db_name. store the backup database under the root directory of disk D. The backup database name is backup20110527. SQL.

Back up the database:


Mysqldump-uroot-p123 db_name> d:/backup20110527. SQL
Restore database:

Delete the original database, create a database, and import the backup database.


Mysqladmin-uroot-p123 drop db_name

Mysqladmin-uroot-p123 create db_name
Mysql-uroot-p123 db_name
Note: before importing the backup database, if db_name does not exist, you need to create it. Besides, the database name in backup20110527. SQL is the same.

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.