MySQL Variables local_infile 数据库 参数变量解释及正确配置使用

本站中文解释

MySQL参数变量local_infile是用来控制MySQL服务器端是否允许从本地文件中读取数据的参数,默认值为0,表示不允许读取本地文件中的数据,如果需要读取本地数据文件,可以把参数设置为1,然后重新启动MySQL数据库服务器,以使此配置生效。需要注意的是,开启此参数可能会带来服务器的安全隐患,建议用户尽量避免使用此参数,只有在确实需要的情况下,才进行使用。

设置local_infile的方法:

1.修改配置文件my.cnf打开local_infile

在配置文件中增加以下一行配置:

local-infile=1

2.使用 set global 指令

直接使用 mysql 命令行中的 set global 语句:

mysql> set global local_infile=1;

官方英文解释

local_infile

Command-Line Format --local-infile[={OFF|ON}]
System Variable local_infile
Scope Global
Dynamic Yes
Type Boolean
Default Value ON

This variable controls server-side LOCAL
capability for LOAD DATA
statements. Depending on the
local_infile setting, the
server refuses or permits local data loading by clients that
have LOCAL enabled on the client side.

To explicitly cause the server to refuse or permit
LOAD DATA
LOCAL
statements (regardless of how client programs
and libraries are configured at build time or runtime), start
mysqld with
local_infile disabled or
enabled, respectively.
local_infile can also be set
at runtime. For more information, see
Section 6.1.6, “Security Considerations for LOAD DATA LOCAL”.


数据运维技术 » MySQL Variables local_infile 数据库 参数变量解释及正确配置使用