Reputation:
Windows 2007 MySQL 5.7
Receiving error :
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
So I assumed that it was simply a privilege error for the directory that I had stored my DB.
So I ran:
SHOW VARIABLES LIKE "secure-file-priv";
and returned:
Empty set (0.00 sec)
so I searched for "my.ini" my.ini is located in C:\ProgramData\MySQL\MySQL Server 5.7
MySQL is installed in C:\Program Files (x86)
I made a copy of my Links.csv into the folder location of my.ini and the error still returned.
Script:
mysql> LOAD DATA INFILE 'Links.csv' INTO TABLE Links;
Upvotes: 3
Views: 9968
Reputation: 16551
I'm using Windows 10.
Check:
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)
If you need to change the path, you must do it in the my.ini
file:
# Secure File Priv.
secure-file-priv="V:/NEW/PATH/TO/MySQL Server/Files"
then restart MySQL: (in my case):
V:\>net stop MySQL
V:\>net start MySQL
Upvotes: 1