简体   繁体   中英

Openshift: Unable to connect to mysql using localhost

Trying to deploy my application on Openshift jboss/mysql gear. My hibernate.cfg.xml contains localhost/db_name as hibernate.connection.url. I would like to maintain it. But hibernate is unable to connect. If I explicitly mention bind_address that I see in my.cnf it works as expected.

Any idea, how can I map my localhost to that bind address? I can't edit my.cnf on Openshift.

You should be using the MySQL environment variables, not "localhost", as your MySQL instance is not listening on localhost. Refer to these two articles on OpenShift environment variables, and mysql in general, they should help you get your application running.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM