How should I tackle --secure-file-priv in MySQL?

mysql 8.0 secure-file-priv
mysql disable secure-file-priv
disable secure-file-priv mysql workbench
disable secure-file-priv mysql windows 10
disable --secure-file-priv option mac
secure-file-priv mysql 8
disable --secure-file-priv option windows
secure_file_priv | null mac

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

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:

  1. Move your file to the directory specified by secure-file-priv.
  2. 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.

How to solve "MySQL server is running with the --secure-file-priv , Comment the line out by adding '#' at the start of the line. Questions: 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 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.

MySQL can't use "LOAD DATA INFILE", secure-file-priv option is , server] groups. You can see a brief summary of options supported by MySQL using: $ mysqld --help. To see the full list,  @Nick: The link mentioned sets to disable the secure_file_priv option which is not correct in my case. Moreover files to be saved from exporting the data from MYSQL is already pointing to the directory specified in secure-file-priv. – Neha0908 Mar 6 '19 at 11:59

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 = ""

error "--secure-file-priv option" when save selection to csv , ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement. I have searched for a  secure-file-priv 지정된 디렉토리로 파일을 이동하십시오. secure-file-priv 비활성화 secure-file-priv. 시작시 제거해야하며 동적으로 수정할 수 없습니다. 이렇게하려면 MySQL 시작 매개 변수 (플랫폼에 따라 다름)와 my.ini를 확인하십시오.

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;

How to solve "MySQL server is running with the --secure-file-priv" Error, is used to limit the effect of data import and export operations. These operations are permitted only to users who have the FILE privilege. To see the current setting at runtime, use the SHOW VARIABLES statement. (or) Alternatively, you can set NULL as value to secure_file_priv.. secure_file_priv = NULL. Restart MySQL service. # /etc/init.d/mysqld restart. Now, you should be able to load data file or output into a file that’s located anywhere in the system.

If the file is local to your machine use the LOCAL in your command

LOAD DATA LOCAL INFILE "text.txt" INTO table mytable;

What is error code: 1290 and how to fix it., 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  ERROR 1290 (HY000): The MySQL server is running with the –secure-file-priv option so it cannot execute this statement. I have searched for a fix and a lot of people recommend to add secure-file-priv = "" to my.cnf file under the mysqld config group. But I know that i am missing smth because I have added the configuration line at my.cnf file

How should I tackle -secure-file-priv in MySQL?, Mysql 5.7: The MySQL server is running with the --secure-file-priv .com/​questions/32737478/how-should-i-tackle-secure-file-priv-in-mysql  Mysql 5.7: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement: LOAD DATA INFILE #9528

Mysql 5.7: The MySQL server is running with the --secure-file-priv , How can we tackle MySQL error 'ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this  Hello Ramesh, Thank you for the report and feedback. Verified as described with 5.6.34 build. Thanks, Umesh

How can we tackle MySQL error 'ERROR 1290 (HY000): The , I could do a quick install of MySQL on my Mac, bring in the dump file MySQL server is running with the --secure-file-priv option so it cannot  The following table shows mysqld options and system variables that affect security. For descriptions of each of these, see Section 5.1.6, “Server Command Options”, and Section 5.1.7, “Server System Variables”.

Comments
  • share path of your csv file
  • 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.
  • in addition for vhu's answer, search below for wolfsshield's answer. you need to switch to '/' to make it work (i am using win10)
  • use LOCAL. LOAD DATA LOCAL INFILE ...
  • By default my.ini can be found from "C:\ProgramData\MySQL\MySQL 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:\ProgramData\MySQL\MySQL Server 5.6\my.ini) as they may also list --secure-file-priv itself.
  • @Mohitbhasi, my-default.ini should be in the "C:\Program Files\MySQL\MySQL Server 5.6" folder. The location vhu was referring to is "C:\ProgramData\MySQL\MySQL Server 5.6". Just in case you haven't noticed.
  • Value: NULL. FML.
  • 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";
  • "check the parameters" and "check my.ini" is not a very good answer
  • This worked for me and none other. I tried: 1. to upload my txt file in C:\ProgramData\MySQL\MySQL Server 5.7\Uploads, 2. disabling secure_file_priv in my.ini and restarting mysql 3. This one! Thanks :)
  • 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.
  • 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"