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