mysql数据库-1.文件导入mysql表secure_file_priv报错问题解决 mysql select outfile不能导出亲测

1.问题
Mac系统,将文件导入mysql表中,报错secure_file_priv选项未设置。
执行导入文件到表mobile_attribute_jxl命令时:
load data infile ‘/home/dm_mobile.txt' into table mobile_attribute_jxl fields terminated by ',' lines terminated by '\n';

报错:
Error: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

2.解决方案
SHOW VARIABLES LIKE "secure_file_priv”;
发现其值为NULL,此时需要在修改secure_file_priv的设置
secure_file_prive=null   -- 限制mysqld 不允许导入导出
secure_file_priv=/tmp/   -- 限制mysqld的导入导出只能发生在/tmp/目录下
secure_file_priv=''     -- 不对mysqld 的导入 导出做限制

1.找到 /private/etc/my.cnf
2.在my.cnf中添加加粗部分语句即可
[mysqld]
max_connections=1024
secure_file_priv=''
[mysql]
Default-character-set=utf8mb4
3.重启mysql服务器
重新导入即可
--------------------- 
作者:JackieChen1992 
来源:CSDN 
原文:https://blog.csdn.net/cshichunhua/article/details/78535755?utm_source=copy 
版权声明:本文为博主原创文章,转载请附上博文链接!

来源:https://blog.csdn.net/cshichunhua/article/details/78535755

猜你喜欢

转载自blog.csdn.net/gb4215287/article/details/83039579
今日推荐