mysql - Openshift:无法使用 localhost 连接到 mysql

标签 mysql openshift

尝试在 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/

相关文章:

node.js - 找不到模块 'forwarded'

Openshift - 'oc' 命令失败并显示 "Unable to connect to the server: x509: certificate signed by unknown authority"

python - 替换 SQL 查询中的值

MySQL 判断系统每小时查询的用户数

php - 我的简单 html php 表单没有插入到数据库中

java - Openshift - EntityManager 没有持久性提供程序

tomcat - 维护授权状态

mysql - 在 MySQL 中以 JSON 格式存储数据

mysql - 转换此选择/连接查询以删除匹配记录

node.js - NodeJS 应用程序部署后无法在 Openshift 上运行