解决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命令导入数据
                
发表回复