I've a Tomcat 7
application running on Openshift
server, say myapp
.
I've also installed MySQL 5.5
cartridge and got the username and password say myUsername
and myPassword
respectively.
I tried to remotely connect to the database by writing a simple PHP script from my php localhost.
<?php
$link = mysql_connect('127.8.217.2:3306', 'myUsername', 'myPassword');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db('myapp',$link) or die ("could not open db".mysql_error());
but the output shows
Could not connect: Access denied for user 'myUsername'@'localhost' (using password: YES)
I don't know what i am missing.
Now the question part.
1) Is it possible to remotely connect to the OpenShift MySQL database
using PHP from either localhost
or some other server ? If yes, How ?
If there's any question, shoot it into the comments.
EDIT
I've looked at port-forwarding
with the help of this thread. but that's not i want.