MySQL:启用 LOAD DATA LOCAL INFILE
我在 Ubuntu 12 LTS 上运行 Mysql 5.5.我应该如何在 my.cnf 中启用 LOAD DATA LOCAL INFILE?
I'm running Mysql 5.5 on Ubuntu 12 LTS. How should I enable LOAD DATA LOCAL INFILE in my.cnf?
我已经尝试在我的配置中的各个地方添加 local-infile,但我仍然收到此 MySQL 版本不允许使用的命令"
I've tried adding local-infile in my config at various places but I'm still getting the "The used command is not allowed with this MySQL version"
推荐答案
来自 MySQL 5.5 手册页:
From the MySQL 5.5 manual page:
LOCAL 仅在您的服务器和客户端都已配置为允许它.例如,如果 mysqld 以--local-infile=0, LOCAL 不起作用.请参见第 6.1.6 节LOAD DATA LOCAL 的安全问题".
LOCAL works only if your server and your client both have been configured to permit it. For example, if mysqld was started with --local-infile=0, LOCAL does not work. See Section 6.1.6, "Security Issues with LOAD DATA LOCAL".
您应该设置选项:
local-infile=1
进入 my.cnf 文件的 [mysql] 条目或使用 --local-infile 选项调用 mysql 客户端:
into your [mysql] entry of my.cnf file or call mysql client with the --local-infile option:
mysql --local-infile -uroot -pyourpwd yourdbname
您必须确保在您的 [mysqld] 部分中也定义了相同的参数,以启用本地 infile"功能服务器端.
You have to be sure that the same parameter is defined into your [mysqld] section too to enable the "local infile" feature server side.
这是一个安全限制.
相关文章