【问题标题】:Openshift: Unable to connect to mysql using localhostOpenshift:无法使用 localhost 连接到 mysql
【发布时间】:2015-04-09 06:21:05
【问题描述】:

尝试在 Openshift jboss/mysql 设备上部署我的应用程序。我的 hibernate.cfg.xml 包含 localhost/db_name 作为 hibernate.connection.url。我想维护它。但是hibernate无法连接。如果我明确提到我在 my.cnf 中看到的 bind_address,它会按预期工作。

任何想法,如何将我的本地主机映射到该绑定地址?我无法在 Openshift 上编辑 my.cnf。

【问题讨论】:

  • localhotst 或 localhost?
  • @pala_ 错字,已更新。
  • 如果改成127.0.0.1/db_name,能用吗?
  • my.cnf 中的bind_address 值是什么?
  • 但不是 127.0.0.1?如果是这样,这就是 localhost 不起作用的原因。它会在您的系统主机文件中设置为指向 127.0.0.1

标签: mysql openshift


【解决方案1】:

您应该使用 MySQL 环境变量,而不是“localhost”,因为您的 MySQL 实例没有在 localhost 上侦听。请参阅这两篇关于 OpenShift 环境变量和一般 mysql 的文章,它们应该可以帮助您运行应用程序。

https://developers.openshift.com/en/managing-environment-variables.html https://developers.openshift.com/en/databases-mysql.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-05
    相关资源
    最近更新 更多