-2

I've deployed a nodejs application at openshift.redhat.com with a mysql and phpmyadmin cartridge. I can access my database fine by going to mywebsite.rhcloud.com/phpmyadmin and logging in with my credentials, but when I try to add a connection to MySQL workbench on my local computer it doesn't seem to connect.

The infomation I'm using is from sshing to my application and typing:

echo $OPENSHIFT_MYSQL_DB_USERNAME
echo $OPENSHIFT_MYSQL_DB_PASSWORD
echo $OPENSHIFT_MYSQL_DB_HOST
echo $OPENSHIFT_MYSQL_DB_PORT

This gives my username, password, host and port which I use in MySQL workbench.

I've tried this: https://stackoverflow.com/a/27333276/2890156

Changed the bind-address from my databse ip to 0.0.0.0, added a new user from the phpmyadmin webinterface with % to allow this account to connect from any ip but it all doesn't seem to work.

I can't figue out what I'm doing wrong or missing, can anyone help me out?

EDIT: Seems the bind-address I've changed has changed back to my remote database ip after restarting the mysql cartridge...

Community
  • 1
  • 1
Denny
  • 1,766
  • 3
  • 17
  • 37
  • Did you restart MySql after changing the bind ip address? Did you check that port 3306 is open in your firewall? – tier1 May 05 '16 at 17:34
  • Yes, I've tried restarting, but I don't know how to check firewall settings – Denny May 05 '16 at 17:40

1 Answers1

0

It's likely that a firewall is blocking access to your hosted database. You can verify this by using a network scan utility like nmap.

I'm going to assume the following for this example, change the respective values if they differ:

  • echo $OPENSHIFT_MYSQL_DB_HOST is mywebsite.rhcloud.com
  • echo $OPENSHIFT_MYSQL_DB_PORT is 3306

After installing it on your local machine, then run the command:

nmap -Pn -p 3306 mywebsite.rhcloud.com

If it's blocked, then you'll get a filtered scan that looks like this:

Starting Nmap 6.40 ( http://nmap.org ) at 2016-05-05 13:05 CDT
Nmap scan report for rhcloud.com (54.174.51.64)
Host is up.
Other addresses for rhcloud.com (not scanned): 52.2.3.89
rDNS record for 54.174.51.64: ec2-54-174-51-64.compute-1.amazonaws.com
PORT     STATE    SERVICE
3306/tcp filtered mysql

Nmap done: 1 IP address (1 host up) scanned in 2.10 seconds

Otherwise, you'll get an open scan like this:

Starting Nmap 6.40 ( http://nmap.org ) at 2016-05-05 13:05 CDT
Nmap scan report for rhcloud.com (54.174.51.64)
Host is up.
Other addresses for rhcloud.com (not scanned): 52.2.3.89
rDNS record for 54.174.51.64: ec2-54-174-51-64.compute-1.amazonaws.com
PORT     STATE SERVICE
3306/tcp open  mysql

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
  • 1
    OpenShift Online only allows external access to databases over port forwarding. https://developers.openshift.com/managing-your-applications/port-forwarding.html –  May 05 '16 at 19:19
  • I'm getting the 'filtered' result, @developercorey trying to follow the guide but it gives me: bash: rhc: command not found – Denny May 05 '16 at 19:39
  • @developercorey could you help me here? http://superuser.com/questions/1073684/openshift-portforwarding-to-remote-access-mysql-database – Denny May 06 '16 at 12:15
  • 1
    Solution that fixed my problem: http://superuser.com/a/1074454/557192 – Denny May 08 '16 at 13:06