错误2002(HY000):无法通过Docker中的套接字连接到本地MySQL服务器

时间:2019-05-02 04:12:18

标签: mysql docker dockerfile

我找到了this码头工人项目,并通过以下方式执行了该项目:

sudo docker run --rm --volume $(pwd):/output_dir:rw jasonkwan/orthomcl_docker:latest run_orthomcl.py --table_path /output_dir/fasta_table --config_file /output_dir/orthomcl.config --processors 2

不幸的是,它导致了此错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
DBI connect('orthomcl:mysql_local_infile=1','root',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /orthomclSoftware-v2.0.9/bin/../lib/perl/OrthoMCLEngine/Main/Base.pm line 56.

更新

我还尝试直接调用MySQL,并发生了相同的错误:

sudo docker run --rm --volume $(pwd):/output_dir:rw jasonkwan/orthomcl_docker:latest mysql -u root -pPAssw0rd -e "create database orthomcl"

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

如何解决?

先谢谢您

0 个答案:

没有答案