1,
使用命令
:mysql> select * from test into outfile ‘d:\test.csv’ fields terminated by ','enclosed by '"'lines terminated by ‘\r\n’;
报错
:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
解决办法:
在my.ini中加上
[mysqld]
secure_file_priv=’’
重启数据库使配置生效
关闭mysql数据库,输入
net stop mysql
提示为:MySQL 服务正在停止.
MySQL 服务已成功停止。
启动数据库: net start mysql
提示为:MySQL 服务正在启动 …
MySQL 服务已经启动成功。
再次运行命令成功:
mysql> select * from test into outfile “d:/test.csv” fields terminated by ','enclosed by '"'lines terminated by ‘\r\n’;
Query OK, 1412 rows affected (0.00 sec)