MySQL 查询结果直接输出成文件报错

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;

MySQL 查询结果直接输出成文件报错

上一篇:Linux gdb调试命令小结


下一篇:MYSQL的优化