Import and export of MySQL database under Mac and Windows system

Source: Internet
Author: User

In the recent process of building a database, you need to export the MySQL database under the Mac OS System to a. sql file and then import it into MySQL under Windows system. The following steps are summed up in the study:

  One, Mac OS export MySQL Database

1. Open the terminal,

2. Execute: The directory to which the CD will be exported (for example: Cd/users/malcolm/desktop)

3. Execution: Mysqldump-u root-p the name > name of the database to be exported is optional. SQL (e.g. Mysqldump-u root-p myproject>sql_name.sql)

At this point, the exported. sql file is found in/users/malcolm/desktop: Sql_name.sql.

  

  Second, Windows System import. sql file

0. Create a new empty database (for example: MyProject)

1. Go to cmd

2. Execution: Mysql-u root-p (ensure that the environment variable path is added to the bin directory path under MySQL)

3. Enter the password, return

4. Execution: Use MyProject

5.mysql>source D/:name.sql

Import and export of MySQL database under Mac and Windows system

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.