DBI 连接('orthomcl:mysql_local_infile=1','root',...)失败

DBI 连接('orthomcl:mysql_local_infile=1','root',...)失败

我有cat orthomcl/Dockerfile

FROM debian:stretch-backports

RUN apt-get update  && apt-get install -y --no-install-recommends \
        wget \
        cpanminus \
        build-essential \
        default-libmysqlclient-dev \
        python \
        ca-certificates \
        && rm -rf /var/lib/apt/lists/*

RUN mkdir diamond \
        && cd diamond \
        && wget -c https://github.com/bbuchfink/diamond/releases/download/v0.9.14/diamond-linux64.tar.gz \
        && tar xvf diamond-linux64.tar.gz \
        && rm *.tar.gz

RUN cpanm DBI DBD::mysql
RUN wget -c https://www.micans.org/mcl/src/mcl-latest.tar.gz
RUN tar xvf mcl-latest.tar.gz
RUN cd mcl-* && ./configure && make && make install
RUN wget -c https://orthomcl.org/common/downloads/software/v2.0/orthomclSoftware-v2.0.9.tar.gz
RUN tar xvf orthomclSoftware-v2.0.9.tar.gz

ENV PATH="/diamond:/orthomclSoftware-v2.0.9/bin:${PATH}"

这是我的docker-compose.yml

orthomcl:
    tty: true
    build: orthomcl
    restart: always
    links:
        - db
    volumes:
        - ./output_dir/:/output_dir

db:
  image: mariadb
  restart: always
  environment:
    - MYSQL_ROOT_PASSWORD="PAssw0rd"
    - MYSQL_DATABASE="orthomcl"
    - MYSQL_USER="orthomcl"
    - MYSQL_PASSWORD="PAssw0rd"
  ports:
    - "3306:3306"
  volumes:
    - ./mysql/:/docker-entrypoint-initdb.d

这是 SQL 配置文件:

$ cat mysql/orthomcl.sql 
CREATE DATABASE IF NOT EXISTS `orthomcl`;
create user `orthomcl`@`db` identified by 'PAssw0rd';
GRANT ALL PRIVILEGES on `orthomcl`.* to `orthomcl`@`db`;

这是应用程序配置文件:

$ cat output_dir/orthomcl.cnf 
dbVendor=mysql
dbConnectString=dbi:mysql:database=orthomcl;host=db;mysql_local_infile=1
dbLogin=orthomcl
dbPassword=PAssw0rd
similarSequencesTable=SimilarSequences
orthologTable=Ortholog
inParalogTable=InParalog
coOrthologTable=CoOrtholog
interTaxonMatchView=InterTaxonMatch
percentMatchCutoff=50
evalueExponentCutoff=-5
oracleIndexTblSpc=NONE

接下来,我使用了docker-compose up它并做了以下操作:

$ docker-compose run orthomcl orthomclInstallSchema /output_dir/orthomcl.cnf orthomclInstallSchema_sql.log 
Starting orthomcl_db_1 ... done
DBI connect('orthomcl:db:mysql_local_infile=1','orthomcl',...) failed: Access denied for user 'orthomcl'@'172.17.0.4' (using password: YES) at /orthomclSoftware-v2.0.9/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm line 56.

MySQL 日志显示:

...
db_1        | 2019-05-03  3:40:06 0 [Note] mysqld: ready for connections.
db_1        | Version: '10.3.14-MariaDB-1:10.3.14+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
db_1        | 2019-05-03  3:40:18 8 [Warning] Access denied for user 'orthomcl'@'172.17.0.4' (using password: YES)

如何解决上述错误?

先感谢您。

相关内容