I am trying to run a simple code to mysql db but it’s preventing me to do so. The code is tested on my xampp environment and it works.
the code that i am trying to use is this:
LOAD DATA INFILE '/var/www/laravelapp/storage/app/file.txt' INTO TABLE test FIELDS TERMINATED BY '|';
the error that I get is: 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 restarted mysql server with the commands:
service mysql restart or service mysql stop service mysql start or /etc/init.d/mysql restart
This is part of my.cnf file:
# This was formally known as [safe_mysqld]. Both versions are currently parsed. [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # secure-file-priv = "" user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1 # # * Fine Tuning
Also tried to add it at the end of the file, in other parts, or to change the syntax:
secure-file-priv = " " secure_file_priv = "" secure_file_priv = " "
but still without success.
Pls any idea how can I run:
LOAD DATA INFILE
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.