php - Openshift MYSQL Cartige IP

651

My scalable osclass app need IP address of MYSQL.I try every thing to find out MYSQL IP but not get it. Following things i tried to find IP:

  1. rhc port-forward -a <appname> command but it show openshift IP address ofHAPROXY andhttpd not for Mysql.http://i.stack.imgur.com/Plujm.png

  2. Then buddy niharvey suggest me to ssh into app and type commandenv | grep MYSQL but result still not show ip address

(3) I even Type URL of MySQL instead of IP what i get from 2 try in osclass database setup page but it not working.

(4) I also try https://www.openshift.com/forums/openshift/how-install-custom-wordpress-setup-on-openshift-server method and edit config-sample.php file of osclass. as wordpess and osclass quite similar but that also not works.

I also post thread on openshift but no reply:(

My question how i get this.I think OPENSHIFT team also allow free tier user to Add PHPMYADMIN for scalble app.

841

Answer

Solution:

Since you are using a scalable application, your IP is actually a fully qualified domain name, you need to use the values of the OPENSHIFT_MYSQL_DB_HOST and OPENSHIFT_MYSQL_DB_PORT environment variables that are shown above.

AND< you should remove that screenshot, since scalable applications database gears are available to all gears on openshift, you are broadcasting your username and password to everyone on the internet...

And if this is your thread on openshift (https://www.openshift.com/forums/openshift/cant-connect-to-database) we did reply to you, you failed to give any details in your forum thread for us to be able to help you.

644

Answer

Solution:

SSH into your app using commandrhc ssh <app> after ssh into your app, type inenv | grep MYSQL then findOPENSHIFT_MYSQL_DB_HOST and copy the value it has something like thisOPENSHIFT_MYSQL_DB_HOST = 56********************43-<domain>.rhcloud.com you need the second part, which is56********************43-<domain>.rhcloud.com then while you are still inside the shell (ssh) of your app, ping the address you just got,ping 56********************43-<domain>.rhcloud.com . the resulting IP is the MYSQL server IP. I usually use the port inOPENSHIFT_MYSQL_DB_URL attached to the ip.

This may (not sure) differ in different apps.

You can extract the value ofOPENSHIFT_MYSQL_DB_URL from theenv | grep MYSQL command I described above.

The value is something similar to thisOPENSHIFT_MYSQL_DB_URL=mysql://<MySQLusername>:<MySQLpassword>@56********************43-<domain>.rhcloud.com:61836

You could extract all the required info from here too.

Good luck on using it!

People are also looking for solutions to the problem: php - I have a quiz and I want to get random questions (no repeat)

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.