ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
网上查了一下应该是这个参数secure-file-priv为空的原因,需要在/etc/my.cnf中设置一下目标路径并重启mysql服务。
mysql> show variables like ‘%secure%’;
±-------------------------±------+
| Variable_name | Value |
±-------------------------±------+
| require_secure_transport | OFF |
| secure_auth | ON |
| secure_file_priv | NULL |
±-------------------------±------+
如果是window 安装的phpstudy那么你应该打开mysql.ini文件,在里面添加这一句
secure-file-priv=D:\
D盘是我安装phpstudy的地方,
然后把你编写好的sql.txt数据文件放在D:\phpStudy\MySQL\data
放在data文件夹里面,然后用load data infile语句添加数据就可以了。
比如:
mysql> load data infile ‘D:\sql.txt’ into table birthdays fields terminated by ‘,’ lines terminated by ‘\r\n’;
这里的D:\sql.txt只是简写,他会直接去找这个名字的文件,去D:\phpStudy\MySQL\data里面找sql.txt文件,而不会直接在D:\这里找,我试过。