尝试在 Openshift jboss/mysql gear 上部署我的应用程序。我的 hibernate.cfg.xml 包含 localhost/db_name 作为 hibernate.connection.url。我想维护它。但是hibernate无法连接。如果我明确提及在 my.cnf 中看到的 bind_address ,它会按预期工作。
知道如何将我的本地主机映射到该绑定(bind)地址吗?我无法在 Openshift 上编辑 my.cnf。
最佳答案
您应该使用 MySQL 环境变量,而不是“localhost”,因为您的 MySQL 实例未在 localhost 上监听。请参阅这两篇有关 OpenShift 环境变量和一般 mysql 的文章,它们应该可以帮助您运行应用程序。
https://developers.openshift.com/en/managing-environment-variables.html https://developers.openshift.com/en/databases-mysql.html
关于mysql - Openshift:无法使用 localhost 连接到 mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29531188/