我的博客
欢迎来到我的博客
bunny.icu

解决MySQL导入数据报错ERROR 1290

解决MySQL导入数据报错ERROR 1290

解决MySQL导入数据报错ERROR 1290

MySQL使用LOAD命令从文件导入数据到数据库出现报错:

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

网上查到的资料大多数都说要修改配置文件,加上一行

secure_file_priv=""

但实际上直接加在最后是不会生效的,必须加在[mysqld]下,通常是配置文件的开头

vim /etc/my.cnf
[mysqld]
secure_file_priv=''

修改后要重启mysql服务

systemctl restart mysql

重启后连接数据库,查询:

mysql> show global variables like '%secure_file_priv%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv |       |
+------------------+-------+
1 row in set (0.00 sec)

结果为空串,而不是NULL,则表示修改成功,可以正常使用LOAD命令导入数据

Reference

mysql5.7导出数据提示–secure-file-priv选项问题的解决方法 – CSDN

版权声明


本作品系原创, 转载须遵循 CC BY-NC-ND 4.0 许可协议
本文标题:解决MySQL导入数据报错ERROR 1290
本文链接:https://www.bunny.icu/archives/1587

推荐文章

发表评论

textsms
account_circle
email

bunny.icu

解决MySQL导入数据报错ERROR 1290
解决MySQL导入数据报错ERROR 1290 MySQL使用LOAD命令从文件导入数据到数据库出现报错: ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so i…
扫描二维码继续阅读
2022-10-06