MySQL 報錯 ERROR 1290 (HY000): running with the --secure-file-priv

不一樣的天空w發表於2019-07-25

mysql> show 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.27 sec)


mysql> select * from test into outfile '/var/lib/mysql-files/test_out.txt' fields terminated by ',' optionally enclo

sed by '"';

Query OK, 5 rows affected (0.21 sec)


secure_file_priv引數說明:

這個引數用來限制資料匯入和匯出操作的效果,例如執行LOAD DATA、SELECT ... INTO OUTFILE語句和LOAD_FILE()函式。這些操作需要使用者具有FILE許可權。

1. 如果這個引數為空,這個變數沒有效果;

2. 如果這個引數設為一個目錄名,MySQL服務只允許在這個目錄中執行檔案的匯入和匯出操作。這個目錄必須存在,MyS

QL服務不會建立它;

3. 如果這個引數為NULL,MySQL服務會禁止匯入和匯出操作。這個引數在MySQL 5.7.6版本引入


secure_file_priv may be set as follows:

If empty, the variable has no effect. This is not a secure setting.

If set to the name of a directory, the server limits import and export operations to work only with files in that dire

ctory. The directory must exist; the server will not create it.

If set to NULL, the server disables import and export operations.


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

相關文章