The MySQL server is running with the --secure-file-priv option so it cannot execute this statement|Mysql Export to Csv

Encountered such a problem: Error Code: 1290. The MySQL server is running
with the --secure-file-priv option so it cannot execute this statement

Example:



Solution:

Check the file priv path



SHOW VARIABLES LIKE "secure_file_priv";
Example:


And then make sure you use that directory in your SELECT statements' INTO OUTFILE clause:

SELECT code,name FROM
    employeemas  INTO OUTFILE 'C:/ProgramData/MySQL/MySQL Server 5.6/Uploads/r.csv'
    FIELDS ENCLOSED BY '"' 
    TERMINATED BY ';' 
    ESCAPED BY '"' LINES 
    TERMINATED BY '\r\n';
Execute Query



you still get this error please check your file path and replace "\" to "/".

security option by adding secure-file-priv to my.ini

secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.6/Uploads"

restart the mysql service .. 

Execute the query..

check the file upload path


Example:



Video tutorial:

Post a Comment

0 Comments