mysqldump -u root -p --all-databases > c:\all_databases_back.sql
(2) 通过命令mysql实现数据还原
mysql -u root -p company < c:\t_dept_back.sql
(3) 实现数据库表导出到文本文件
执行SELECT...INTO OUTFILE实现导出到文本文件
select *
from t_dept
into outfile 'c:/t_dept.txt';
# 格式化
select *
from t_dept
into outfile 'c:/t_dept.txt'
fields terminated by '\、'
optionally enclosed by '\"'
lines starting by '\>'
terminated by '\r\n';
执行命令mysql实现导出到文本文件
mysql -u root -proot -e"select * from t_dept" company > c:/t_dept.txt