I am trying to connect to a MySQL5 database from remote.
I set up the database in my cpanel, created a user with full permissions and enabled “Allow Remote Connection”
In my script, which is running on another server I have the following code:
CODE
$host="http://www.mysite.com:/tmp/mysql5.sock";
$user="dodie";
$pass="student";
$dbname="mysite_domain";
//Connect to database
$connection = mysql_pconnect($host,$user,$pass);
if($connection)
echo "Connected to Database Successfully";
else
mysql_error();
//Select database to open
mysql_select_db($dbname);
I am getting the following error:
Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user: dodie@server503.com' (Using password: YES) in /home/mysite/www/connect_remote.php on line 17
I have also tried replacing the
CODE
$host="http://www.mysite.com:/tmp/mysql5.sock";
with
CODE
$host="213.24.172.63:/tmp/mysql5.sock";
but I get the same error.
I have also tried:
CODE
mysql_connect ('mysql.http://www.mysite.com', $user, $pass) or die (mysql_error ());
I am obviously missing something here but I don’t know if it is an error on Server-A where the script is located or on Server-B where the database is located.
Any help much appreciated.
This post has been edited by douffle: 6 May, 2008 - 02:36 PM