SELECT sid,sname,gender,dept_id INTO OUTFILE ‘/tmp/students.txt‘ FROM students;
报错:1 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement SQL.sql 536 1
解决办法:在配置文件my.ini 中查看secure-file-priv的值是什么,然后把输出文件的内容文件放在该值的后面,例如:
# Secure File Priv.
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads"
那么上面的语句:SELECT sid,sname,gender,dept_id INTO OUTFILE ‘C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/students.txt‘ FROM students;