mysql使用select语句导出表数据时,报error 1290解决方法

在使用SELECT...INTO OUTPUT导出数据时报错ERROR 1290 (HY000),语句如下:

select * into outfile 'd:abc.txt'
fields terminated by ','
optionally enclosed by '"'
lines terminated by '
'
from emp;

MYSQL导出数据报错”ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement”

分析:提示信息-secure-file-priv可看出是文件导出做了限制。所以在配置中修改限制信息。

说明:

secure_file_prive=null   限制mysqld 不允许导入导出

secure_file_priv=” C:/ProgramData/MySQL/MySQL Server 8.0/Uploads”   限制mysqld的导入导出只能发生在C:/ProgramData/MySQL/MySQL Server 8.0/Uploads目录下

secure_file_priv=' '     不对mysqld的导入导出做限制

解决方法 :

我是不想进行限制,所以解决方法就是在mysql配置文件中添加secure_file_priv=' '

1、    打开windows的my.ini文件,我的版本mysql8.0,配置文件路径:C:ProgramDataMySQLMySQL Server 8.0my.ini

2、    在my.ini文件 [mysqld]节点 下添加secure_file_priv=''

3、    重启mysql8.0服务

再次执行导出语句即可。

原文地址:https://www.cnblogs.com/pinpin/p/12191545.html