如何在spring应用程序中从docker连接到localhost mysql base

问题描述

我尝试将 docker 中的 Spring Boot 应用程序与基于 localhost 的 MysqL 连接

这是我的 application.properties,但应用程序找不到基础

server.port = 8080


spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:MysqL://${MysqL_HOST:localhost}:3306/TestDB?useUnicode=true&serverTimezone=UTC&useSSL=true&verifyServerCertificate=false
spring.datasource.username=test
spring.datasource.password=test

我认为容器中 MysqL 的 IP 与 localhost 上的 IP 不同

如何在本地主机上连接到 MysqL

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)