5

谁知道如何在 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;
4

1 回答 1

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

我也在mysql.cnf下加了

[client]
      loose-local-infile=1

为我工作

于 2012-12-27T22:21:39.543 回答