MySQL database import and Export

Source: Internet
Author: User

Mysql:

Http://dev.mysql.com/downloads

Download connector introduced into the project

Go to cmd (note in OS cmd instead of MySQL)

Note: First go to the Bin folder in the MySQL directory: cd MySQL to the Bin folder directory
As I entered the command line:CD C:\Program files\mysql\mysql Server 4.1\bin
(or add the directory to the Windows environment variable path directly)
===================
1. Export database (SQL script)
Mysqldump-u user name-p database name > exported file name
Mysqldump-u root-p db_name >test_db.sql
2.mysql Export Database A table
Mysqldump-u user name-P database name Table name > exported file name
Mysqldump-u wcnc-p test_dbusers> test_users.sql (end no semicolon)

On the MySQL command line

===================

3. Import the Database

  SOURCE Mydb.sql

Detailed Export Database process:

MySQL command line export database:
1. Go to the Bin folder in the MySQL directory: cd MySQL to the Bin folder directory
As I entered the command line:CD C:\ProgramFiles\MySQL\MySQL Server 4.1\bin
(or add the directory to the Windows environment variable path directly)


2, Export database: Mysqldump-u user name-p database name > exported file name
As I entered the command line: Mysqldump-u root-p News > News.sql

3, you will see the file News.sql automatically generated into the bin file

Note: The reasons for setting environment variables:

In the Java and Tomcat installation process many times need to configure the value of the system environment variables, but why must be set, can not set it?

The answer is yes, the environment variable settings just let the environment know this path, take the above export database as an example, if not first into the bin path is not configured with the path of the MySQL bin, it will be prompted: ' mysqldump ' is not internal or external command, is not a running program. The reason is simple because the system does not know it, and into the bin directory, the system knows, it can be called, so the system environment variable configuration is also the reason for it!

MySQL database import and Export

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.