Wont connect to remote mysql
| From: | Blake Crosby | Date: | Tue, 07 Oct 2003 03:55:25 +0000 |
| Subject: | Wont connect to remote mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-30889@lists.php.net to get a copy of this message | ||
Hello,
For some reason php will not connect to a remote mysql server.. Using the
following code:
<?php
$link = mysql_connect('hostname:3306', "username", "password")
or die("Could not connect: " . mysql_error() . "\n");
print ("Connected successfully");
mysql_close($link);
?>
Returns the following error:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2) in /vws/blakecrosby.com/docs/test.php on line 2
Could not connect: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
I can connect to the database using the mysql client from the same machine.
Any suggestions?