【Mysql】into outfile報錯的問題

小亮520cl發表於2017-05-31
明明有select 許可權卻報錯
mysql> select * from server into outfile '/tmp/tt.txt';
ERROR 1045 (28000): Access denied for user 'chenliang'@'%' (using password: YES)

百度後需要給file許可權
mysql>  grant file on *.* to chenliang;
Query OK, 0 rows affected (0.00 sec)


再次導還是報錯
mysql> select * from server into outfile '/tmp/tt.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
--這次錯誤不一樣了,這個錯誤是一個引數導致的


配置檔案加入後重啟
secure_file_priv=''  


匯出成功
mysql> select * from server into outfile '/tmp/tt.txt';
Query OK, 27 rows affected (0.00 sec)


這個引數我以前在5.6.24版本都沒調整過,可能預設值就是‘’,高版本預設值改成null,所以一定要注意

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29096438/viewspace-2140122/,如需轉載,請註明出處,否則將追究法律責任。

相關文章