mysql导入导出示例教程,欢迎在线阅读学习mysql 导入、导出教程。
随着数据的增多,数据的备份显得日益重要,下面是mysql常用的数据导入导出命令。
1.导出整个数据库
格式:mysqldump -u 用户名 -p 数据库名 > 导出的文件名
举例:
C:\Documents and Settings\Owner>mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 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> select * from user;
+--------+----------+----------+---------------+
| userid | username | password | email |
+--------+----------+----------+---------------+
| 1 | aaa | aaa | aaaa |
| 2 | bbb | bbbb | bbbb@sina.com|
+--------+----------+----------+---------------+
2 rows in set (0.00 sec)
mysql> select * from user1;
+--------+----------+----------+---------------+
| userid | username | password | email |
+--------+----------+----------+---------------+
| 1 | cccc | cccc | cccc |
| 2 | cccc | cccc | cccc@sina.com|
+--------+----------+----------+---------------+
2 rows in set (0.00 sec)