加载本地infile不允许perl mysql

时间:2012-10-31 09:42:12

标签: mysql perl

谁知道如何在Ubuntu上的最新MySQL中启用加载本地infile设置?我编辑了/etc/mysql/my.cnf文件并添加了

local-infile=1

在Perl代码中

dbConnectString=dbi:mysql:orthomcl:mysqllocalinfile=1

但仍然得到

DBD::mysql::st execute failed: The used command is not allowed with this MySQL version...

它被名为OrthoMCL的应用程序

使用

我尝试配置my.cnf文件:

sudo vim /etc/mysql/my.cnf

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
local-infile = 1
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
local-infile = 1

然后重启mysql服务器:

sudo service mysql restart
mysql stop/waiting
mysql start/running, process 9563

但是我仍然得到:

DBD::mysql::st execute failed: The used command is not allowed with this MySQL version at ../Apps/orthomclSoftware-v2.0.3/bin/orthomclLoadBlast line 39, <F> line 12.
The used command is not allowed with this MySQL version at ../Apps/orthomclSoftware-v2.0.3/bin/orthomclLoadBlast line 39, <F> line 12.`

第39行是:

$stmt->execute() or die DBI::errstr;

执行上面的行:

my $sql = "
LOAD DATA
LOCAL INFILE \"$blastFile\"
REPLACE INTO TABLE $sst
FIELDS TERMINATED BY '\\t'
";
my $stmt = $dbh->prepare($sql) or die DBI::errstr;

1 个答案:

答案 0 :(得分:6)

dbConnectString=dbi:mysql:orthomcl:mysql_local_infile=1:localhost:3306

我也在mysql.cnf中添加了

[client]
      loose-local-infile=1

为我工作