加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

加载本地infile不允许perl mysql

发布时间:2020-12-16 06:26:12 所属栏目:大数据 来源:网络整理
导读:谁知道如何在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
谁知道如何在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;

解决方法

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

我也在mysql.cnf中添加了

[client]
      loose-local-infile=1

为我工作

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读