• 欢迎访问水熊虫网站,这里是我个人的工作博客,内容大多是遇到问题完善后,会在这里进行总结归纳内容! QQ群
  • 网站导航中的友情链接专栏上线,更新的都是自己这三年整理的一些东西,感兴趣可以看看!
  • 你所浪费的今天,是昨天死去的人奢望的明天。你所厌恶的现在,是未来的你回不去的曾经!

♡ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

MySQL WaterBear 7年前 (2017-08-04) 802次浏览 已收录 扫描二维码

环境说明:CentOS6.X+WDCPv3.0.8版本(lanmp)
错误原因:用户执行脚本报错。
错误内容为:

ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

用户脚本内容如下:

#!/bin/bash 
rm -rf /tmp/sleep_processes.txt 
mysql -hlocalhost -uroot -pwOCtXimmg6jiK3Wb  -e "select concat('KILL ',id,';') from information_schema.processlist where Command =  'Sleep' AND user = 'root' into outfile '/tmp/sleep_processes.txt'" 
mysql -hlocalhost -uroot -pwOCtXimmg6jiK3Wb  -e "source /tmp/sleep_processes.txt;" 
rm -rf /tmp/sleep_processes.txt

测试出错内容为执行该语句报错:

select concat('KILL ',id,';') from information_schema.processlist where Command = 'Sleep' AND user = 'root' into outfile '/tmp/sleep_processes.txt'

查询得知语句用途为结束长时间运行未结束的mysql进程详细内容参见:http://www.cnblogs.com/siqi/p/3984499.html
输出错误为:
♡ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
错误原因:
上网查了一下,使用 into outfile导出数据的时候出现错误:应该是mysql设置的权限,可以使用
show variables like '%secure%';查看 secure-file-priv 当前的值是什么。
♡ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
如果 secure-file-priv 当前的值默认是NULL就代表禁止导出,所以需要设置一下。导出的数据必须是这个值的指定路径才可以正常导出。查看用户需要导出文件路径为:/tmp/sleep_processes.txt,所以这里需要设置的路径为/tmp/
那在mysql的配置文件[mysqld]设置单元中添加设置,添加内容为:secure-file-priv=/tmp/ 。修改保存之后,重启mysql服务
再次测试结果如下:
♡ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
测试正常,问题处理完毕

参考文章如下:
http://blog.csdn.net/learner_lps/article/details/65448098
http://blog.csdn.net/man_to_home/article/details/54947518


WaterBear , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:♡ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement
喜欢 (0)
[[email protected]]
分享 (0)