MYSQL新特性secure_file_priv讀寫文件


1290 – The MySQL server is running with the –secure-file-priv option so it cannot execute this statement

secure-file-priv特性

secure-file-priv參數是用來限制LOAD DATA, SELECT … OUTFILE, and LOAD_FILE()傳到哪個指定目錄的。

  • ure_file_priv的值為null ,表示限制mysqld 不允許導入|導出
  • 當secure_file_priv的值為/tmp/ ,表示限制mysqld 的導入|導出只能發生在/tmp/目錄下
  • 當secure_file_priv的值沒有具體值時,表示不對mysqld 的導入|導出做限制

如何查看secure-file-priv參數的值:

show global variables like '%secure%';

沒有導出權限:

mysql> show global variables like '%secure%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_auth      | OFF   |
| secure_file_priv |       |
+------------------+-------+
2 rows in set (0.00 sec)

有導出權限,導出路徑需在/var/lib/mysql-files/下:

mysql> show global variables like '%secure%';
+--------------------------+-----------------------+
| Variable_name            | Value                 |
+--------------------------+-----------------------+
| require_secure_transport | OFF                   |
| secure_auth              | ON                    |
| secure_file_priv         | /var/lib/mysql-files/ |
+--------------------------+-----------------------+
3 rows in set (0.09 sec)

MYSQL新特性secure_file_priv對讀寫文件的影響

此開關默認為NULL,即不允許導入導出。

解決問題:
windows下:

修改my.ini 在[mysqld]內加入secure_file_priv=

linux下:

修改my.cnf 在[mysqld]內加入secure_file_priv=
MYSQL新特性secure_file_priv對讀寫文件的影響
然后重啟mysql,再查詢secure_file_priv


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM