在数据库中导出文件:
select * from tb_test01 into outfile 'test.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
需要在配置文件/etc/my.cnf
加入:
secure_file_priv=/tmp
这个时候可以把文件导入到到/tmp 文件夹内
select * from tb_test01 into outfile '/tmp/test.txt';命令行:
mysql -uroot -p -e "select * from data1.tb_test01 where id=1;" > /tmp/test01.txt
导出整个表:
mysqldump -uroot -p data1 tb_test01 > test01.txt
或者整个数据库: mysqldump -uroot -p data1 > test01.txt导入数据库:
mysql -uroot -p data1 < test01.txt
或者进入mysql: source /tmp/test01.txt
mysql 导出文件
猜你喜欢
转载自www.cnblogs.com/wanderingfish/p/10841844.html
今日推荐
周排行