导出mysql数据库到SQL以及导入SQL到数据库

导出数据库testschema到c盘testschema.sql:

 

 

C:\>mysqldump -h 127.0.0.1 -u root -pRoot123 testschema > c:/testschema.sql
 

 导入c盘testschema.sql到数据库testschema2:

 

C:\>mysql -h 127.0.0.1 -uroot -pRoot123
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.47-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create schema testschema2;
Query OK, 1 row affected (0.03 sec)

mysql> use testschema2;
Database changed
mysql> source C:\testschema.sql
 

 

 

你可能感兴趣的:(mysql)