select ... into outfile语法
select * from students order by score limit 100
into outfile '/database/mysql/tmp/students.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\ '
LINES TERMINATED BY '\n';
- FIELDS TERMINATED BY 表示列分隔符
- [OPTIONALLY] ENCLOSED BY 表示列用什么字符包括起来,
- ESCAPED BY 表示当需要转义时用什么作为转义字符
- LINES TERMINATED BY 表示每行记录之间用什么分隔
标签:TERMINATED,secure,into,---,outfile,select From: https://www.cnblogs.com/ariesblog/p/17493438.html[NOTE]
想要运行此语句需要设置好secure_file_priv
参数,此参数为只读参数,无法在线修改,在"/etc/my.cnf"中[mysqld]下添加secure_file_priv = /database/mysql/tmp