Re: Wont connect to remote mysql
| From: | Blake Crosby | Date: | Tue, 07 Oct 2003 04:14:54 +0000 |
| Subject: | Re: Wont connect to remote mysql | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30890@lists.php.net to get a copy of this message | ||
That's not it.
The user can connect to the database using the mysql client on the same
machine as the webserver to the database machine.
Blake
On 07/10/2003 12:03 AM, "Andy Green" <_agreen@bellsouth.net> wrote:
> check the permissions granted to the user to make sure that it's not
> restricted to localhost only. i had the same problem you're describing not
> too long ago, and i discovered that the user name i was passing was
> restricted to localhost only.
>
> the permissions can be viewed in the 'host' attributes, found in the 'user'
> table in the 'mysql' database.
>
> hope this helps
>
> green
>
> -----Original Message-----
> From: Blake Crosby [mailto:me@blakecrosby.com]
> Sent: Monday, October 06, 2003 11:55 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Wont connect to remote mysql
>
>
> 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?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>