gpt4 book ai didi

mysql - Artifactory 无法连接到主机 mysql

转载 作者:行者123 更新时间:2023-11-29 17:43:29 25 4
gpt4 key购买 nike

我正在尝试执行以下命令。

docker run --name artifactory-host-mysql -e DB_TYPE=mysql -e DB_HOST=my_host_ip -e DB_URL='jdbc:mysql://my_host_ip:3306/some_db?characterEncoding=UTF-8&elideSetAutoCommits=true' -e DB_PORT=3306  -e DB_USER=my_db_user -e DB_PASSWORD=my_passowrd -d -p 8083:8083 --net=host -v /artifactory/mysql-connector-java-5.1.46.jar:/opt/jfrog/artifactory/tomcat/lib/mysql-connector-java-5.1.46.jar artifactory-hostmysql

输出如下

Preparing to run Artifactory in Docker
=====================================
2018-04-19 05:32:46 [44 entrypoint-artifactory.sh] Dockerfile for this image can found inside the container.
2018-04-19 05:32:46 [282 entrypoint-artifactory.sh] Checking DB_TYPE
2018-04-19 05:32:46 [285 entrypoint-artifactory.sh] DB_TYPE is set to mysql
2018-04-19 05:32:46 [213 entrypoint-artifactory.sh] DB_HOST is set to my_ip
2018-04-19 05:32:46 [215 entrypoint-artifactory.sh] Checking if need to copy mysql configuration
2018-04-19 05:32:46 [231 entrypoint-artifactory.sh] Copying mysql configuration...
2018-04-19 05:32:46 [239 entrypoint-artifactory.sh] Setting DB_URL to jdbc:mysql://my_ip:3306/some_db?characterEncoding=UTF-8&elideSetAutoCommits=true
2018-04-19 05:32:46 [243 entrypoint-artifactory.sh] Setting DB_USER to artifactory
2018-04-19 05:32:46 [247 entrypoint-artifactory.sh] Setting DB_PASSWORD to **********
2018-04-19 05:32:46 [251 entrypoint-artifactory.sh] Setting DB_PORT to 3306
2018-04-19 05:32:46 [266 entrypoint-artifactory.sh] Setting DB_HOST to my_ip
2018-04-19 05:32:46 [190 entrypoint-artifactory.sh] Waiting for DB mysql to be ready on my_ip/3306 within 30 seconds
2018-04-19 05:32:46 [198 entrypoint-artifactory.sh] .
2018-04-19 05:33:16 [198 entrypoint-artifactory.sh] .
2018-04-19 05:33:17 [34 entrypoint-artifactory.sh] ERROR: DB mysql failed to start in the given time
<小时/>

mysql服务已经在主机上运行端口 3306 也为 TCP 打开 - netstat -tlnp 的输出如下

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -

最佳答案

以下解决方案对我有用。

bind-address            = 0.0.0.0

在文件/etc/mysql/mysql.conf.d/mysqld.cnf中

关于mysql - Artifactory 无法连接到主机 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49914035/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com