Mysql Import and Export SQL files (including database and data table operations), mysql Import and Export

Source: Internet
Author: User
Tags mysql import

Mysql Import and Export SQL files (including database and data table operations), mysql Import and Export

Let's just get started.

Log on to mysql under the windows command line, create a database test_01, create a user table, and insert a piece of data, as shown below:

 

1. Export the database test_01

1. log out of the database and enter

Mysqldump -- no-defaults-u root-p test_01> d: \ test01. SQL (without a colon, press enter directly)

2. Enter the password

Note: The command line must be in the system,

-- No-defaults cannot be saved (the reason is unknown ),

Test_01 is the source database, 01. SQL is the target database

Result: The 01. SQL file is displayed in d: \ test.

2. Export the data table user in the database test_01

Command: mysqldump -- no-defaults-u root-p test_01 user> d: \ test \ user. SQL

Result: The user. SQL file is displayed in d: \ test.

 

3. Import the user table to the database test_01

First, log on to the database and delete the user table drop table user;

Then, if you have selected the test_01 database, enter the command source d: \ test \ user. SQL.

And then it succeeds.

 

4. Import the database (01. SQL)

First, delete the database test_01,

Drop database test_01;

 

Then create a database, such as test_01 (previously deleted to better import ^_^)

Create database test_01;

Select test_01 use test_01

 

Enter source d: \ 01. SQL

Show tables;

Successful!

These are my most convenient and common import and export operations. Thank you for your criticism!

 

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.