MySQL只能导出文件到设定的目录,可以使用以下方式查看:
mysql> select @@secure_file_priv ; +-----------------------+ | @@secure_file_priv | +-----------------------+ | /var/lib/mysql-files/ | +-----------------------+ 1 row in set (0.00 sec)
执行查询语句:
select ce.name, cep.name, contact_name, contact_mobile INTO OUTFILE '/var/lib/mysql-files/export-20170516.csv' FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' from c4_contest_enroll_project cep inner join c4_contest_enroll ce on cep.enroll_id=ce.enroll_id where service_requirements like '%参加训练营%';
如果文件已经存在将会出错。
相关内容
· 数据备份策略