加载本地infile不允许perl mysql

Jas*_*per 5 mysql perl

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

local-infile=1
Run Code Online (Sandbox Code Playgroud)

并在Perl代码中

dbConnectString=dbi:mysql:orthomcl:mysqllocalinfile=1
Run Code Online (Sandbox Code Playgroud)

但仍然得到

DBD::mysql::st execute failed: The used command is not allowed with this MySQL version...
Run Code Online (Sandbox Code Playgroud)

它由名为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
Run Code Online (Sandbox Code Playgroud)

然后重启mysql服务器:

sudo service mysql restart
mysql stop/waiting
mysql start/running, process 9563
Run Code Online (Sandbox Code Playgroud)

但后来我仍然得到:

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.`
Run Code Online (Sandbox Code Playgroud)

第39行是:

$stmt->execute() or die DBI::errstr;
Run Code Online (Sandbox Code Playgroud)

执行上面的行:

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

小智 6

dbConnectString=dbi:mysql:orthomcl:mysql_local_infile=1:localhost:3306
Run Code Online (Sandbox Code Playgroud)

我也在mysql.cnf下添加了

[client]
      loose-local-infile=1
Run Code Online (Sandbox Code Playgroud)

为我工作