I have a Spring Boot based REST application that is deployed on Pivotal Cloud Foundry (PCF) and working fine. But this REST application did not had any DB connection till now. Hence, I decided to install MySQL service on PCF from the marketplace and finally got it bounded to my application successfully.
However, the problem is that I am NOT able to connect to this newly created MySQL instance via CLI or any other GUI.
So far I have followed following links but no luck.
- https://docs.pivotal.io/pivotalcf/2-4/devguide/deploy-apps/ssh-services.html
- How to setup mysql develper for PCF mySQL database to manage it
The steps that I performed in order to accomplish this are:
- Created service instance for
MySQLsuccessfully Bound the service instance for
MySQLto the application successfully (see thecf services command result above)# cf services
name service plan bound apps last operation
my-mysql-db cleardb spark agrisell-rest-app create succeededPushed my app successfully and can hit the
REST APIsuccessfullyEnabled
sshon the host app usingcf enable-ssh agrisell-rest-appsuccessfullyCreated service key using
cf create-service-key my-mysql-db my-mysql-db-service-key(the command for fetching service keys after creation is shown below)# cf service-keys my-mysql-db
name my-mysql-db-service-key
Retrieved service key and DB credentials using following command
cf service-key my-mysql-db my-mysql-db-service-key
{
"hostname": "us-cdbr-iron-east-01.cleardb.net",
"jdbcUrl": "jdbc:mysql://us-cdbr-iron-east-01.cleardb.net/ad_b509d7f388732d5?user=hello123\u0026password=world456",
"name": "ad_b509d7f388732d5",
"password": "world456",
"port": "3306",
"uri": "mysql://b311794a3c31eb:ca7ad71f@us-cdbr-iron-east-01.cleardb.net:3306/ad_b509d7f388732d5?reconnect=true",
"username": "hello123"
}
Configured
SSHtunnel successfullycf ssh -L 63306:us-cdbr-iron-east-01.cleardb.net:3306 agrisell-rest-app
Accessing the service instance through
CLIvcap@33eb3942-10bd-4068-650f-64fc:~$ mysql -u hello123 -h 0 -p -D ad_b509d7f388732d5 -P 63306 bash: mysql: command not found
Based the above error it felt to me as if did not install the mysql plugins correctly but I already have them installed.
# cf plugins
Listing installed plugins...
plugin version command name command help
mysql 2.0.0 mysql Connect to a MySQL database service
mysql 2.0.0 mysqldump Dump a MySQL database
Use 'cf repo-plugins' to list plugins in registered repos available to install.
Second Approach:
Second approach I tried was to connect to the PCF MySQL DB through MySQL Workbench which comes bundled with MySQL server installation on Windows.
I use it to connect to my local MySQL DB. I modified the settings to point it to the host, db and changed credentials and tried to connect which did not work either.
Third Approach
Third approach that I tried was installing Pivotal MySQL Web Database Management tool which I from one of the PCF documentation
https://docs.pivotal.io/p-mysql/2-2/use.html#mysqlweb
I installed it on my Windows 10 machine (did not deploy it to PCF) and tried to log in but that also failed.
Second Approach Tried and Failed
Based on your response Arun, I followed all the instructions mentioned in the Readme here (https://github.com/pivotal-cf/PivotalMySQLWeb) but it does not allow me to login to the application with DB URL and credentials. The first login with credentials admin/cfmysqlweb works but the login page where it requires DB credentials and password it send me back to the first login screen with a message "Bad Credentials". Screenshot below.
Deployed the PivotalMysqlWeb on PCF and bound it to DB instance
Login Page that shows up now after basic authentication is successful using admin/cfmysqlweb credentials
DB credentials entered above and on submit I am taken back to the first login page (Back to square one)


