Go MySQL import and export SQL scripts

Source: Internet
Author: User
Tags mysql import

First, the mysqldump command is used only if it is entered in the Bin directory under the MySQL installation directory in cmd.
My MySQL is installed on the e: disk, so first go to the bin directory:
E:/program Files/mysql/mysql Server 5.0/bin>
Then, you can use the command.


1. Export the entire database

Mysqldump-u user name-p database name > storage location

Like what:
Mysqldump-u Root-p Project > C:/a.sql

(Exporting the Project database has been tested, successfully!) )



2. Export the structure of a table with the data in the table

Mysqldump-u user name-P database name Table name > exported file name

Mysqldump-u root-p Project Position > C:/a.sql

(Test, Success!) )

Only the table structure is exported, with no data in the table:

mysqldump-d-u root-p Project position > C:/a.sql

(Test, Success!) )

3. Export a database structure

Mysqldump-u Wcnc-p-D--add-drop-table SMGP_APPS_WCNC >d:wcnc_db.sql
-D No data--add-drop-table add a drop table before each CREATE statement

4. Import the database

Common source Commands
Go to MySQL Database console,
D:/program files/mysql/mysql Server 5.1/bin > Mysql-u root-p
D:/program files/mysql/mysql Server 5.1/bin > Mysql>use ' database '
Then use the source command, followed by the script file (for example, the. SQL used here)
D:/program files/mysql/mysql Server 5.1/bin > Mysql>source d:wcnc_db.sql


5. Remote Export Database

The command is as follows:

Mysqldump-h 192.168.11.210-u root-p Test>c:/test.sql

Go MySQL import and export SQL scripts

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.