How should I tackle --secure-file-priv in MySQL?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
I got the following error:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
How do I tackle this error?
I have checked another question on the same error message, but still can’t find a solution.
I am using MySQL 5.6
mysql database
add a comment |
I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
I got the following error:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
How do I tackle this error?
I have checked another question on the same error message, but still can’t find a solution.
I am using MySQL 5.6
mysql database
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
Of course, you get this error when trying to usemysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.
– William Entriken
Mar 9 '17 at 16:19
add a comment |
I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
I got the following error:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
How do I tackle this error?
I have checked another question on the same error message, but still can’t find a solution.
I am using MySQL 5.6
mysql database
I am learning MySQL and tried using a LOAD DATA
clause. When I used it as below:
LOAD DATA INFILE "text.txt" INTO table mytable;
I got the following error:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
How do I tackle this error?
I have checked another question on the same error message, but still can’t find a solution.
I am using MySQL 5.6
mysql database
mysql database
edited May 23 '17 at 12:26
Community♦
11
11
asked Sep 23 '15 at 10:43
Mohit BhasiMohit Bhasi
3,66542135
3,66542135
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
Of course, you get this error when trying to usemysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.
– William Entriken
Mar 9 '17 at 16:19
add a comment |
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
Of course, you get this error when trying to usemysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.
– William Entriken
Mar 9 '17 at 16:19
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
Of course, you get this error when trying to use
mysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.– William Entriken
Mar 9 '17 at 16:19
Of course, you get this error when trying to use
mysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.– William Entriken
Mar 9 '17 at 16:19
add a comment |
12 Answers
12
active
oldest
votes
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
You have two options:
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list--secure-file-priv
itself.
– vhu
Sep 23 '15 at 10:59
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results ofSHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
|
show 12 more comments
I had the same issue. I finally solved using the LOCAL
option in the command
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE mytable;
You can find more info here http://dev.mysql.com/doc/refman/5.7/en/load-data.html
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
2
This worked for me and none other. I tried: 1. to upload my txt file inC:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disablingsecure_file_priv
inmy.ini
and restarting mysql 3. This one! Thanks :)
– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
@AlisonS Try adding the--local-infile
flag when runningmysql
. stackoverflow.com/questions/10762239/…
– Illya Moskvin
May 30 '18 at 14:36
|
show 7 more comments
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-
[mysqld]
secure-file-priv = ""
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like# secure-file-priv = ~
then it still has the error since the value shows asNULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.
– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
add a comment |
I'm working on MySQL5.7.11 on Debian, the command that worked for me to see the directory is:
mysql> SELECT @@global.secure_file_priv;
WithSHOW VARIABLES LIKE "secure_file_priv";
I getERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. TheSELECT @@global.secure_file_priv;
command though produced the expected result.
– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
add a comment |
If the file is local to your machine use the LOCAL in your command
LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;
add a comment |
Here is what worked for me in Windows 7 to disable secure-file-priv
(Option #2 from vhu's answer):
- Stop the MySQL server service by going into
services.msc
. - Go to
C:ProgramDataMySQLMySQL Server 5.6
(ProgramData
was a hidden folder in my case). - Open the
my.ini
file in Notepad. - Search for 'secure-file-priv'.
- Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one -
secure-file-priv=""
- Save the file.
- Start the MySQL server service by going into
services.msc
.
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
add a comment |
I had the same problem with 'secure-file-priv'. Commenting in the .ini file didn't work and neither did moving file in directory specified by 'secure-file-priv'.
Finally, as dbc suggested, making 'secure-file-priv' equal to an empty string worked. So if anyone is stuck after trying answers above, hopefully doing this will help.
add a comment |
I had all sorts of problems with this. I was changing my.cnf and all sorts of crazy things that other versions of this problem tried to show.
What worked for me:
The error I was getting
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
I was able to fix it by opening /usr/local/mysql/support-files/mysql.server and changing the following line:
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" -- $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
to
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --secure-file-priv="" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
add a comment |
The thing that worked for me:
- Put your file inside of the folder specified in
secure-file-priv
.
To find that type:
mysql> show variables like "secure_file_priv";
- Check if you have
local_infile = 1
.
Do that typing:
mysql> show variables like "local_infile";
If you get:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
Then set it to one typing:
mysql> set global local_infile = 1;
- Specify the full path for your file. In my case:
mysql> load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/file.txt" into table test;
add a comment |
I had this problem on windows 10. "--secure-file-priv in MySQL" To solve this I did the following.
- In windows search (bottom left) I typed "powershell".
- Right clicked on powershell and ran as admin.
- Navigated to the server bin file. (C:Program FilesMySQLMySQL Server 5.6bin);
- Typed ./mysqld
- Hit "enter"
The server started up as expected.
add a comment |
MySQL use this system variable to control where you can import you files
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | NULL |
+------------------+-------+
So problem is how to change system variables such as secure_file_priv
.
- shutdown
mysqld
sudo mysqld_safe --secure_file_priv=""
now you may see like this:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
add a comment |
Detailed example on how to check secure_file_priv, grant user and select into outfile yippeecode.com
add a comment |
protected by Community♦ Nov 6 '16 at 5:55
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
You have two options:
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list--secure-file-priv
itself.
– vhu
Sep 23 '15 at 10:59
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results ofSHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
|
show 12 more comments
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
You have two options:
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list--secure-file-priv
itself.
– vhu
Sep 23 '15 at 10:59
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results ofSHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
|
show 12 more comments
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
You have two options:
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
It's working as intended. Your MySQL server has been started with --secure-file-priv option which basically limits from which directories you can load files using LOAD DATA INFILE
.
You may use SHOW VARIABLES LIKE "secure_file_priv";
to see the directory that has been configured.
You have two options:
- Move your file to the directory specified by
secure-file-priv
. - Disable
secure-file-priv
. This must be removed from startup and cannot be modified dynamically. To do this check your MySQL start up parameters (depending on platform) and my.ini.
edited Sep 23 '15 at 10:54
answered Sep 23 '15 at 10:51
vhuvhu
8,035113039
8,035113039
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list--secure-file-priv
itself.
– vhu
Sep 23 '15 at 10:59
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results ofSHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
|
show 12 more comments
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list--secure-file-priv
itself.
– vhu
Sep 23 '15 at 10:59
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results ofSHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
2
2
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list
--secure-file-priv
itself.– vhu
Sep 23 '15 at 10:59
By default my.ini can be found from "C:ProgramDataMySQLMySQL Server 5.6" when running MySQL 5.6 on W2012 server. You may also want to check the service startup parameters (e.g. --defaults-file="C:ProgramDataMySQLMySQL Server 5.6my.ini) as they may also list
--secure-file-priv
itself.– vhu
Sep 23 '15 at 10:59
1
1
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
@Mohitbhasi, my-default.ini should be in the "C:Program FilesMySQLMySQL Server 5.6" folder. The location vhu was referring to is "C:ProgramDataMySQLMySQL Server 5.6". Just in case you haven't noticed.
– NurShomik
Jan 16 '16 at 7:20
32
32
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
Value: NULL. FML.
– William Entriken
Mar 9 '17 at 16:20
3
3
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results of
SHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
Note that if using "select .. into outfile" you must specify the full path and the full path must match the results of
SHOW VARIABLES LIKE "secure_file_priv";
– TheSatinKnight
Feb 17 '18 at 17:49
4
4
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
"check the parameters" and "check my.ini" is not a very good answer
– Roland Seuhs
Mar 21 '18 at 16:09
|
show 12 more comments
I had the same issue. I finally solved using the LOCAL
option in the command
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE mytable;
You can find more info here http://dev.mysql.com/doc/refman/5.7/en/load-data.html
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
2
This worked for me and none other. I tried: 1. to upload my txt file inC:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disablingsecure_file_priv
inmy.ini
and restarting mysql 3. This one! Thanks :)
– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
@AlisonS Try adding the--local-infile
flag when runningmysql
. stackoverflow.com/questions/10762239/…
– Illya Moskvin
May 30 '18 at 14:36
|
show 7 more comments
I had the same issue. I finally solved using the LOCAL
option in the command
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE mytable;
You can find more info here http://dev.mysql.com/doc/refman/5.7/en/load-data.html
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
2
This worked for me and none other. I tried: 1. to upload my txt file inC:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disablingsecure_file_priv
inmy.ini
and restarting mysql 3. This one! Thanks :)
– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
@AlisonS Try adding the--local-infile
flag when runningmysql
. stackoverflow.com/questions/10762239/…
– Illya Moskvin
May 30 '18 at 14:36
|
show 7 more comments
I had the same issue. I finally solved using the LOCAL
option in the command
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE mytable;
You can find more info here http://dev.mysql.com/doc/refman/5.7/en/load-data.html
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
I had the same issue. I finally solved using the LOCAL
option in the command
LOAD DATA LOCAL INFILE "text.txt" INTO TABLE mytable;
You can find more info here http://dev.mysql.com/doc/refman/5.7/en/load-data.html
If LOCAL is specified, the file is read by the client program on the
client host and sent to the server. The file can be given as a full
path name to specify its exact location. If given as a relative path
name, the name is interpreted relative to the directory in which the
client program was started.
edited Nov 16 '16 at 11:10
answered Nov 16 '16 at 10:54
StazaStaza
1,8161711
1,8161711
2
This worked for me and none other. I tried: 1. to upload my txt file inC:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disablingsecure_file_priv
inmy.ini
and restarting mysql 3. This one! Thanks :)
– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
@AlisonS Try adding the--local-infile
flag when runningmysql
. stackoverflow.com/questions/10762239/…
– Illya Moskvin
May 30 '18 at 14:36
|
show 7 more comments
2
This worked for me and none other. I tried: 1. to upload my txt file inC:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disablingsecure_file_priv
inmy.ini
and restarting mysql 3. This one! Thanks :)
– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
@AlisonS Try adding the--local-infile
flag when runningmysql
. stackoverflow.com/questions/10762239/…
– Illya Moskvin
May 30 '18 at 14:36
2
2
This worked for me and none other. I tried: 1. to upload my txt file in
C:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disabling secure_file_priv
in my.ini
and restarting mysql 3. This one! Thanks :)– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me and none other. I tried: 1. to upload my txt file in
C:ProgramDataMySQLMySQL Server 5.7Uploads
, 2. disabling secure_file_priv
in my.ini
and restarting mysql 3. This one! Thanks :)– Kamal Nayan
Nov 23 '16 at 14:58
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
This worked for me too. I was going to move the files to the secure-fle-priv directory but I didn't have to because this worked perfectly.
– adg
Mar 4 '17 at 9:17
7
7
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
I got this error message for MariaDB: "ERROR 1148 (42000): The used command is not allowed with this MariaDB version". The exact version: "mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.2"
– jciloa
Jul 18 '17 at 11:56
8
8
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
I got "The used command is not allowed with this MySQL version" for mysql version 5.7.19.
– Alison S
Oct 5 '17 at 21:14
1
1
@AlisonS Try adding the
--local-infile
flag when running mysql
. stackoverflow.com/questions/10762239/…– Illya Moskvin
May 30 '18 at 14:36
@AlisonS Try adding the
--local-infile
flag when running mysql
. stackoverflow.com/questions/10762239/…– Illya Moskvin
May 30 '18 at 14:36
|
show 7 more comments
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-
[mysqld]
secure-file-priv = ""
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like# secure-file-priv = ~
then it still has the error since the value shows asNULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.
– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
add a comment |
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-
[mysqld]
secure-file-priv = ""
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like# secure-file-priv = ~
then it still has the error since the value shows asNULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.
– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
add a comment |
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-
[mysqld]
secure-file-priv = ""
On Ubuntu 14 and Mysql 5.5.53 this setting seems to be enabled by default. To disable it you need to add secure-file-priv = ""
to your my.cnf file under the mysqld config group. eg:-
[mysqld]
secure-file-priv = ""
edited Feb 15 '18 at 4:15
answered Nov 4 '16 at 9:49
MustafaMustafa
1,95511528
1,95511528
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like# secure-file-priv = ~
then it still has the error since the value shows asNULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.
– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
add a comment |
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like# secure-file-priv = ~
then it still has the error since the value shows asNULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.
– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
This worked for me as well. Same version of Ubuntu and MySQL
– Rodney
Nov 13 '16 at 14:24
1
1
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
+1 Worked for me. If you are using Ubuntu, don't forget restart mysql service: sudo service mysql restart
– Emiliano Sangoi
Jul 20 '17 at 4:07
1
1
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like
# secure-file-priv = ~
then it still has the error since the value shows as NULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
This is what works if you need it to point to a location that you select per statement where applicable. This works with MySQL 5.7 on Windows Server just as you explained. If you simply comment out the line like
# secure-file-priv = ~
then it still has the error since the value shows as NULL
doing it this way resolves the problem when you want to pick which directories you can export to on the server, etc.– Bitcoin Murderous Maniac
Mar 5 '18 at 19:06
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
Worked for me with MySQL 5.7 on Windows, whereas the other solutions did not.
– CGritton
Dec 3 '18 at 21:47
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
NB: if doing this in Docker you must restart the Docker container.
– user1717828
Feb 15 at 14:13
add a comment |
I'm working on MySQL5.7.11 on Debian, the command that worked for me to see the directory is:
mysql> SELECT @@global.secure_file_priv;
WithSHOW VARIABLES LIKE "secure_file_priv";
I getERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. TheSELECT @@global.secure_file_priv;
command though produced the expected result.
– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
add a comment |
I'm working on MySQL5.7.11 on Debian, the command that worked for me to see the directory is:
mysql> SELECT @@global.secure_file_priv;
WithSHOW VARIABLES LIKE "secure_file_priv";
I getERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. TheSELECT @@global.secure_file_priv;
command though produced the expected result.
– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
add a comment |
I'm working on MySQL5.7.11 on Debian, the command that worked for me to see the directory is:
mysql> SELECT @@global.secure_file_priv;
I'm working on MySQL5.7.11 on Debian, the command that worked for me to see the directory is:
mysql> SELECT @@global.secure_file_priv;
answered May 25 '16 at 19:34
CarlosArturoFyulerCarlosArturoFyuler
28237
28237
WithSHOW VARIABLES LIKE "secure_file_priv";
I getERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. TheSELECT @@global.secure_file_priv;
command though produced the expected result.
– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
add a comment |
WithSHOW VARIABLES LIKE "secure_file_priv";
I getERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. TheSELECT @@global.secure_file_priv;
command though produced the expected result.
– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
With
SHOW VARIABLES LIKE "secure_file_priv";
I get ERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. The SELECT @@global.secure_file_priv;
command though produced the expected result.– Majid Fouladpour
Jun 4 '17 at 16:28
With
SHOW VARIABLES LIKE "secure_file_priv";
I get ERROR 1146 (42S02): Table 'performance_schema.session_variables' doesn't exist
which is also thrown in other circumstances and I will have to eventually deal with. The SELECT @@global.secure_file_priv;
command though produced the expected result.– Majid Fouladpour
Jun 4 '17 at 16:28
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
This worked for me -- Ubuntu Mysql 5.7.21: changed the output file to directory /var/lib/mysql-files/output.txt
– Shanemeister
Apr 26 '18 at 17:42
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
How you edit it then? I tried to edit it in /etc/mysql/my.cnf and it seems to have no effect - it stays NULL
– Slavik
Mar 14 at 7:32
add a comment |
If the file is local to your machine use the LOCAL in your command
LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;
add a comment |
If the file is local to your machine use the LOCAL in your command
LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;
add a comment |
If the file is local to your machine use the LOCAL in your command
LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;
If the file is local to your machine use the LOCAL in your command
LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;
answered May 4 '18 at 14:07
garyrgilbertgaryrgilbert
24528
24528
add a comment |
add a comment |
Here is what worked for me in Windows 7 to disable secure-file-priv
(Option #2 from vhu's answer):
- Stop the MySQL server service by going into
services.msc
. - Go to
C:ProgramDataMySQLMySQL Server 5.6
(ProgramData
was a hidden folder in my case). - Open the
my.ini
file in Notepad. - Search for 'secure-file-priv'.
- Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one -
secure-file-priv=""
- Save the file.
- Start the MySQL server service by going into
services.msc
.
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
add a comment |
Here is what worked for me in Windows 7 to disable secure-file-priv
(Option #2 from vhu's answer):
- Stop the MySQL server service by going into
services.msc
. - Go to
C:ProgramDataMySQLMySQL Server 5.6
(ProgramData
was a hidden folder in my case). - Open the
my.ini
file in Notepad. - Search for 'secure-file-priv'.
- Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one -
secure-file-priv=""
- Save the file.
- Start the MySQL server service by going into
services.msc
.
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
add a comment |
Here is what worked for me in Windows 7 to disable secure-file-priv
(Option #2 from vhu's answer):
- Stop the MySQL server service by going into
services.msc
. - Go to
C:ProgramDataMySQLMySQL Server 5.6
(ProgramData
was a hidden folder in my case). - Open the
my.ini
file in Notepad. - Search for 'secure-file-priv'.
- Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one -
secure-file-priv=""
- Save the file.
- Start the MySQL server service by going into
services.msc
.
Here is what worked for me in Windows 7 to disable secure-file-priv
(Option #2 from vhu's answer):
- Stop the MySQL server service by going into
services.msc
. - Go to
C:ProgramDataMySQLMySQL Server 5.6
(ProgramData
was a hidden folder in my case). - Open the
my.ini
file in Notepad. - Search for 'secure-file-priv'.
- Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one -
secure-file-priv=""
- Save the file.
- Start the MySQL server service by going into
services.msc
.
edited Apr 4 at 1:15
answered Jun 15 '16 at 13:55
RamnathRamnath
5251823
5251823
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
add a comment |
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
13
13
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
As of MySQL Server 5.7.16, commenting out the line will not work, because then it will revert to the default, which disables import and export operations. You now need to set it to an empty string if you want to allow these operations from any directory.
– dbc
Oct 25 '16 at 14:24
1
1
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Ramnath, please, edit your answer with @dbc detail for 5.7.x version. Thanks.
– Rafael Gomes Francisco
Sep 20 '17 at 20:25
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
Adding an empty string works for me; please change the answer to add an empty string like secure-file-priv=""
– Rajesh Goel
Jun 26 '18 at 23:35
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
For Windows make sure to use forward slashes
– Oliver Oliver
Mar 31 at 23:16
add a comment |
I had the same problem with 'secure-file-priv'. Commenting in the .ini file didn't work and neither did moving file in directory specified by 'secure-file-priv'.
Finally, as dbc suggested, making 'secure-file-priv' equal to an empty string worked. So if anyone is stuck after trying answers above, hopefully doing this will help.
add a comment |
I had the same problem with 'secure-file-priv'. Commenting in the .ini file didn't work and neither did moving file in directory specified by 'secure-file-priv'.
Finally, as dbc suggested, making 'secure-file-priv' equal to an empty string worked. So if anyone is stuck after trying answers above, hopefully doing this will help.
add a comment |
I had the same problem with 'secure-file-priv'. Commenting in the .ini file didn't work and neither did moving file in directory specified by 'secure-file-priv'.
Finally, as dbc suggested, making 'secure-file-priv' equal to an empty string worked. So if anyone is stuck after trying answers above, hopefully doing this will help.
I had the same problem with 'secure-file-priv'. Commenting in the .ini file didn't work and neither did moving file in directory specified by 'secure-file-priv'.
Finally, as dbc suggested, making 'secure-file-priv' equal to an empty string worked. So if anyone is stuck after trying answers above, hopefully doing this will help.
answered Nov 2 '16 at 20:59
Rsc RscRsc Rsc
7114
7114
add a comment |
add a comment |
I had all sorts of problems with this. I was changing my.cnf and all sorts of crazy things that other versions of this problem tried to show.
What worked for me:
The error I was getting
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
I was able to fix it by opening /usr/local/mysql/support-files/mysql.server and changing the following line:
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" -- $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
to
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --secure-file-priv="" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
add a comment |
I had all sorts of problems with this. I was changing my.cnf and all sorts of crazy things that other versions of this problem tried to show.
What worked for me:
The error I was getting
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
I was able to fix it by opening /usr/local/mysql/support-files/mysql.server and changing the following line:
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" -- $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
to
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --secure-file-priv="" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
add a comment |
I had all sorts of problems with this. I was changing my.cnf and all sorts of crazy things that other versions of this problem tried to show.
What worked for me:
The error I was getting
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
I was able to fix it by opening /usr/local/mysql/support-files/mysql.server and changing the following line:
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" -- $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
to
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --secure-file-priv="" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
I had all sorts of problems with this. I was changing my.cnf and all sorts of crazy things that other versions of this problem tried to show.
What worked for me:
The error I was getting
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
I was able to fix it by opening /usr/local/mysql/support-files/mysql.server and changing the following line:
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" -- $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
to
$bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" --secure-file-priv="" $other_args >/dev/null &
wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
answered Dec 1 '16 at 20:54
notthehoffnotthehoff
6091723
6091723
add a comment |
add a comment |
The thing that worked for me:
- Put your file inside of the folder specified in
secure-file-priv
.
To find that type:
mysql> show variables like "secure_file_priv";
- Check if you have
local_infile = 1
.
Do that typing:
mysql> show variables like "local_infile";
If you get:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
Then set it to one typing:
mysql> set global local_infile = 1;
- Specify the full path for your file. In my case:
mysql> load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/file.txt" into table test;
add a comment |
The thing that worked for me:
- Put your file inside of the folder specified in
secure-file-priv
.
To find that type:
mysql> show variables like "secure_file_priv";
- Check if you have
local_infile = 1
.
Do that typing:
mysql> show variables like "local_infile";
If you get:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
Then set it to one typing:
mysql> set global local_infile = 1;
- Specify the full path for your file. In my case:
mysql> load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/file.txt" into table test;
add a comment |
The thing that worked for me:
- Put your file inside of the folder specified in
secure-file-priv
.
To find that type:
mysql> show variables like "secure_file_priv";
- Check if you have
local_infile = 1
.
Do that typing:
mysql> show variables like "local_infile";
If you get:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
Then set it to one typing:
mysql> set global local_infile = 1;
- Specify the full path for your file. In my case:
mysql> load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/file.txt" into table test;
The thing that worked for me:
- Put your file inside of the folder specified in
secure-file-priv
.
To find that type:
mysql> show variables like "secure_file_priv";
- Check if you have
local_infile = 1
.
Do that typing:
mysql> show variables like "local_infile";
If you get:
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
Then set it to one typing:
mysql> set global local_infile = 1;
- Specify the full path for your file. In my case:
mysql> load data infile "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/file.txt" into table test;
answered Dec 30 '18 at 5:31
Vinícius SouzaVinícius Souza
416
416
add a comment |
add a comment |
I had this problem on windows 10. "--secure-file-priv in MySQL" To solve this I did the following.
- In windows search (bottom left) I typed "powershell".
- Right clicked on powershell and ran as admin.
- Navigated to the server bin file. (C:Program FilesMySQLMySQL Server 5.6bin);
- Typed ./mysqld
- Hit "enter"
The server started up as expected.
add a comment |
I had this problem on windows 10. "--secure-file-priv in MySQL" To solve this I did the following.
- In windows search (bottom left) I typed "powershell".
- Right clicked on powershell and ran as admin.
- Navigated to the server bin file. (C:Program FilesMySQLMySQL Server 5.6bin);
- Typed ./mysqld
- Hit "enter"
The server started up as expected.
add a comment |
I had this problem on windows 10. "--secure-file-priv in MySQL" To solve this I did the following.
- In windows search (bottom left) I typed "powershell".
- Right clicked on powershell and ran as admin.
- Navigated to the server bin file. (C:Program FilesMySQLMySQL Server 5.6bin);
- Typed ./mysqld
- Hit "enter"
The server started up as expected.
I had this problem on windows 10. "--secure-file-priv in MySQL" To solve this I did the following.
- In windows search (bottom left) I typed "powershell".
- Right clicked on powershell and ran as admin.
- Navigated to the server bin file. (C:Program FilesMySQLMySQL Server 5.6bin);
- Typed ./mysqld
- Hit "enter"
The server started up as expected.
answered Oct 1 '17 at 22:05
Jason AllshornJason Allshorn
1,1331822
1,1331822
add a comment |
add a comment |
MySQL use this system variable to control where you can import you files
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | NULL |
+------------------+-------+
So problem is how to change system variables such as secure_file_priv
.
- shutdown
mysqld
sudo mysqld_safe --secure_file_priv=""
now you may see like this:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
add a comment |
MySQL use this system variable to control where you can import you files
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | NULL |
+------------------+-------+
So problem is how to change system variables such as secure_file_priv
.
- shutdown
mysqld
sudo mysqld_safe --secure_file_priv=""
now you may see like this:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
add a comment |
MySQL use this system variable to control where you can import you files
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | NULL |
+------------------+-------+
So problem is how to change system variables such as secure_file_priv
.
- shutdown
mysqld
sudo mysqld_safe --secure_file_priv=""
now you may see like this:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
MySQL use this system variable to control where you can import you files
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | NULL |
+------------------+-------+
So problem is how to change system variables such as secure_file_priv
.
- shutdown
mysqld
sudo mysqld_safe --secure_file_priv=""
now you may see like this:
mysql> SHOW VARIABLES LIKE "secure_file_priv";
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| secure_file_priv | |
+------------------+-------+
answered Mar 3 at 14:01
bitfishxyzbitfishxyz
5151417
5151417
add a comment |
add a comment |
Detailed example on how to check secure_file_priv, grant user and select into outfile yippeecode.com
add a comment |
Detailed example on how to check secure_file_priv, grant user and select into outfile yippeecode.com
add a comment |
Detailed example on how to check secure_file_priv, grant user and select into outfile yippeecode.com
Detailed example on how to check secure_file_priv, grant user and select into outfile yippeecode.com
answered Mar 5 at 16:40
helloworld2013helloworld2013
1,69341323
1,69341323
add a comment |
add a comment |
protected by Community♦ Nov 6 '16 at 5:55
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
share path of your csv file
– Zafar Malik
Sep 23 '15 at 10:50
Of course, you get this error when trying to use
mysqldump --tab
, as if it wasn't hard enough to get your own data out of mysql.– William Entriken
Mar 9 '17 at 16:19