导出数据库
[root@localhost ~]# mysqldump -u root -p testdb>/tmp/testdb.sql
导入数据库
格式:常用source 命令
进入mysql数据库控制台:

[root@localhost ~]# mysqi -u root -p
Enter password:                 ----输入密码
mysql> use testdb;
Database changed
mysql> source testdb.sql;



1. 导出整张数据表
命令行进入安装目录/Bin/mysqldump -u用户名 -p密码 -hIP地址或localhost 数据库名 表名 > C:\table1.txt 回车
[root@localhost ~]# mysqldump -uroot -p123123 -h localhost webcrawler City > /tmp/City.txt

2. 根据条件导出表中的数据
命令行进入安装目录/Bin/mysqldump -u用户名 -p密码 -hIP地址或localhost 数据库名 表名 --where="条件" > C:\table2.txt 回车

例如:
命令行进入安装目录/Bin/mysqldump -u用户名 -p密码 -hIP地址或localhost 数据库名 表名 --where="id>100 and userName like 'Lee%' order by id limit 100" > C:\demo2.txt 回车