Disable secure priv for data loading on MySQL

sachin
edited June 2022 in database

Getting error while output file to cdv from a select

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.13    |
+-----------+
1 row in set (0,00 sec)

mysql> SELECT @@GLOBAL.secure_file_priv;
+---------------------------+
| @@GLOBAL.secure_file_priv |
+---------------------------+
| NULL                      |
+---------------------------+
1 row in set (0,00 sec)

-- USE ...

mysql> SELECT * FROM customer WHERE createdate = '2021-01-01' ORDER BY c1.time_stamp DESC, c1.id DESC INTO OUTFILE '/var/www/html/2021-01.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv
option so it cannot execute this statement
Tagged:

Comments

  • edit `vi /etc/my.cnf` and add

    [mysqld]
    secure_file_priv=""
    

    After

    service mysqld restart
    


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!