2012-10-31 45 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應該足夠了。 –

相關問題