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

前端 未结 21 1535
攒了一身酷
攒了一身酷 2020-11-22 06:04

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;
21条回答
  •  温柔的废话
    2020-11-22 06:12

    Here is what worked for me in Windows 7 to disable secure-file-priv (Option #2 from vhu's answer):

    1. Stop the MySQL server service by going into services.msc.
    2. Go to C:\ProgramData\MySQL\MySQL Server 5.6 (ProgramData was a hidden folder in my case).
    3. Open the my.ini file in Notepad.
    4. Search for 'secure-file-priv'.
    5. Comment the line out by adding '#' at the start of the line. For MySQL Server 5.7.16 and above, commenting won't work. You have to set it to an empty string like this one - secure-file-priv=""
    6. Save the file.
    7. Start the MySQL server service by going into services.msc.

提交回复
热议问题