Pivotal Web Services (PWS)
MySQL for Pivotal Cloud Foundry
When attempting to connect to a PWS MySQL instance via an external MySQL management tool you will receive the error.
Can't connect to MySQL server on 'p-mysql-proxy.run.pivotal.io' (10060)
There is no direct access to them from the cloud because they are shielded externally by AWS networking rules. The PWS MySQL DB instances are not externally visible and are only accessible by your apps.
A workaround to this is to use SSH Tunneling and the MySQL CLI.
Configure an SSH tunnel to your service instance using cf ssh. Tailor the example command below with information from your service key.
$ cf ssh -L 63306:us-cdbr-iron-east-01.p-mysql.net:3306 YOUR-HOST-APP
- Use any available local port for port forwarding. For example,
us-cdbr-iron-east-01.p-mysql.netwith the address provided under
hostnamein the service key retrieved above.
3306with the port provided under
YOUR-HOST-APPwith the name of your host app.
After you enter the command, open another terminal window and perform the steps below.
To establish direct command-line access to your service instance, use the relevant command line tool for that service. This example uses the MySQL command line client to access the p-mysql service instance.
$ mysql -u b5136e448be920 -h 0 -p -D ad_b2fca6t49704585d -P 63306
b5136e448be920with the username provided under
usernamein your service key.
mysqlto connect to your local machine.
mysqlto prompt for a password. When prompted, use the password provided under
passwordin your service key.
ad_b2fca6t49704585dwith the database name provided under
namein your service key.
mysqlto connect on port
Alternatively, deploying a tool on PWS such as phpMyAdmin is also an option. You can find an example of a CF ready version here. You must change the local port to 63306.