Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

load local infile not allowed perl mysql

Tags:

mysql

perl

Who knows how to turn on load local infile settings in the latest MySQL on Ubuntu? I edited the /etc/mysql/my.cnf file and added

local-infile=1

And in the Perl code

dbConnectString=dbi:mysql:orthomcl:mysqllocalinfile=1

but still get

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

It is used by an application called OrthoMCL

I tried configuring my.cnf file:

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

Then a restart of the mysql server:

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

But then I still get:

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.`

Line 39 is:

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

which executes the lines above:

my $sql = "
LOAD DATA
LOCAL INFILE \"$blastFile\"
REPLACE INTO TABLE $sst
FIELDS TERMINATED BY '\\t'
";
my $stmt = $dbh->prepare($sql) or die DBI::errstr;
like image 707
Jasper Avatar asked Oct 31 '12 09:10

Jasper


People also ask

How do I enable local Infile in mysql?

To disable or enable it explicitly, use the --local-infile=0 or --local-infile[=1] option. For the mysqlimport client, local data loading is not used by default. To disable or enable it explicitly, use the --local=0 or --local[=1] option.

What is load data infile in mysql?

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. If the LOCAL keyword is specified, the file is read from the client host. If LOCAL is not specified, the file must be located on the server. ( LOCAL is available in MySQL 3.22.

Which statement is used to load data from file to table in mysql?

mysql> LOAD DATA LOCAL INFILE '/path/pet. txt' INTO TABLE pet; If you created the file on Windows with an editor that uses \r\n as a line terminator, you should use this statement instead: mysql> LOAD DATA LOCAL INFILE '/path/pet.


1 Answers

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

I added also in mysql.cnf under

[client]
      loose-local-infile=1

worked for me

like image 82
baverhey Avatar answered Nov 05 '22 11:11

baverhey