artifactory未连接到主机mysql

khbbv19g  于 2021-06-25  发布在  Mysql
关注(0)|答案(1)|浏览(584)

我试图执行下面的命令。

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      -
00jrzges

00jrzges1#

下面的解决方案对我有效。

bind-address            = 0.0.0.0

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

相关问题