Windows 2007 MySQL 5.7
接收错误:
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
所以我假设这只是我存储数据库的目录的权限错误。
所以我跑了:
SHOW VARIABLES LIKE "secure-file-priv";
并返回:
Empty set (0.00 sec)
所以我搜索了“my.ini” my.ini位于C:\ProgramData\MySQL\MySQL Server 5.7
MySQL 安装在 C:\Program Files (x86)
我将 Links.csv 的副本复制到 my.ini 的文件夹位置,但仍然返回错误。
脚本:
mysql> LOAD DATA INFILE 'Links.csv' INTO TABLE Links;
最佳答案
我正在使用 Windows 10。
检查:
mysql> SELECT VERSION();
+------------+
| VERSION() |
+------------+
| 5.7.17-log |
+------------+
1 row in set (0.00 sec)
mysql> SHOW VARIABLES LIKE 'secure_file_priv';
+------------------+--------------------------------+
| Variable_name | Value |
+------------------+--------------------------------+
| secure_file_priv | V:\PATH\TO\MySQL Server\Files\ |
+------------------+--------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> SELECT `VARIABLE_VALUE`
-> FROM `performance_schema`.`global_variables`
-> WHERE `VARIABLE_NAME` = 'secure_file_priv';
+--------------------------------+
| VARIABLE_VALUE |
+--------------------------------+
| V:\PATH\TO\MySQL Server\Files\ |
+--------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> SELECT @@GLOBAL.secure_file_priv;
+--------------------------------+
| @@GLOBAL.secure_file_priv |
+--------------------------------+
| V:\PATH\TO\MySQL Server\Files\ |
+--------------------------------+
1 row in set (0.00 sec)
如果需要更改路径,必须在my.ini
文件中进行:
# Secure File Priv.
secure-file-priv="V:/NEW/PATH/TO/MySQL Server/Files"
然后重新启动 MySQL:(在我的例子中):
V:\>net stop MySQL
V:\>net start MySQL
关于mysql - secure-file-priv 空集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42394518/