导出一个数据库结构
格式:mysqldump -u 用户名 -p -d –add-drop-table 数据库 > 导出的文件名
说明:-d 选项表示没有数据
–add-drop-table 选项说明在每个create语句之前增加一个drop table
举例:表结构与上面的相同
C:MySQLMySQL Server 5.0bin>mysqldump -u root -p -d –add-drop-table testdb > testdbstruct.sql
Enter password:
导入数据库
格式:常用source 命令
进入mysql数据库控制台:
C:MySQLMySQL Server 5.0bin>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 10 to server version: 5.0.7-beta-nt
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
mysql> use testdb;
Database changed
mysql> source testdb.sql;
Query OK, 0 rows affected (0.05 sec)
testdb.sql放在C:MySQLMySQL Server 5.0bin目录下,如果不在这个目录下则要指定路径
原创文章,转载请注明: 转载自PT Ubuntu Blog