MySQL ERROR 1290 (HY000) --secure-file-priv option

后端 未结 9 1410
醉话见心
醉话见心 2020-11-30 03:19

I am trying to write the results of MySQL script to a text file using the following code in my script.

SELECT p.title, p.content, c.name FROM post p
LEFT JOI         


        
9条回答
  •  孤城傲影
    2020-11-30 03:38

    That's because secure_file_priv is set to NULL

    mysql> show variables like secure_file_priv;

    | secure_file_priv | NULL  |
    

    You must stop mysql server

    shell>/usr/local/mysql/support-files/mysql.server stop
    

    Then restart mysql with the option defining where you want your files to be written to, for example to /tmp

    shell>/usr/local/mysql/support-files/mysql.server start --secure-file-priv=/tmp
    

    Then in mysql terminal you should see where your files can now be written to

    mysql> show variables like secure_file_priv;

    | secure_file_priv | /private/tmp/ |
    

    On Mac you can find this folder by using Go To Folder /private/tmp in Finder

提交回复
热议问题