MySQL:启用LOAD DATA LOCAL INFILE [英] MySQL: Enable 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.
这是安全限制.
这篇关于MySQL:启用LOAD DATA LOCAL INFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!