into outfile ‘目标文件’,目标文件是保存在mysql的服务器端,因为sql语句都是在服务器端执行了。所以执行完后目标文件会保存在mysql服务器端。into outfile '/tmp/test.csv',一般是mysql服务器是在linux上;into outfile 'E:/test.csv' ,一般是mysql服务器端在windows上。并且目标文件必须有写入权限,而且文件不能存在。
select * from proxy_list order by id asc limit 0,2 into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';
select uid, nation from system_user order by uid asc limit 0,2 into outfile 'e:/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';
Copyright © 2019- uude.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务