MySQL Backup and recovery

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

To export a database:

1, Windows cmd Open command line

2, CD to the bin directory of the installation directory of MySQL, if the bin directory is added to the environment variable does not need to switch to the bin directory

3. Export database: Mysqldump-u username-P database name > exported file name

For example, enter a command on the command line mysqldump-u root-p person >d:\person.sql (input will let you enter the password into MySQL)
(If you export a single table, enter the table name after the database name)

4, after the completion of the implementation, you will see the D disk has person.sql file

MySQL Command line Import Database
1. Enter mysql:mysql-u user name-P
As I entered the command line: mysql-u root-p (Input the same will let you enter the MySQL password)
2, create a new database, this is an empty database, such as a new target database named person
3, Input: Mysql>use target database name
As I entered the command line: mysql>use person;
4, import file: mysql>source import filename;
As I entered the command line: Mysql>source d:/person.sql;

MySQL Backup and recovery

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.