How should I tackle --secure-file-priv in MySQL?

前端 未结 21 1530
攒了一身酷
攒了一身酷 2020-11-22 06:04

I am learning MySQL and tried using a LOAD DATA clause. When I used it as below:

LOAD DATA INFILE \"text.txt\" INTO table mytable;
21条回答
  •  醉梦人生
    2020-11-22 06:17

    MySQL use this system variable to control where you can import you files

    mysql> SHOW VARIABLES LIKE "secure_file_priv";
    +------------------+-------+
    | Variable_name    | Value |
    +------------------+-------+
    | secure_file_priv | NULL  |
    +------------------+-------+
    

    So problem is how to change system variables such as secure_file_priv.

    1. shutdown mysqld
    2. sudo mysqld_safe --secure_file_priv=""

    now you may see like this:

    mysql> SHOW VARIABLES LIKE "secure_file_priv";
    +------------------+-------+
    | Variable_name    | Value |
    +------------------+-------+
    | secure_file_priv |       |
    +------------------+-------+
    

提交回复
热议问题