2012-10-31 46 views
5

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

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; 
+0

[设置负载INFILE](http://stackoverflow.com/questions/10762239/enable- load-data-local-infile)更新面临的问题@Jasper – gks

+0

我更新了我的帖子,并提到我确实尝试过这个帖子,但没有一个可以工作。 – Jasper

+0

你的'dbConnectString'对我来说有一个奇怪的格式。它应该像'dbi:DriverName:database_name' –

回答

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

我还添加了在mysql.cnf

[client] 
     loose-local-infile=1 

工作对我来说

+0

解决了我与orthoMCL的问题。谢谢。 – Morlock

+0

将mysql_local_infile = 1添加到DBI DSN应该足够了。 –

相关问题