On May 29, 2005, at 11:13 AM, [EMAIL PROTECTED] wrote:

<?php

$server = "localhost:/var/mysql/mysql.sock";
$user="mysuperuser";
$password="mypassword";
$db = "mysql";

mysql_connect($server, $user, $password);
mysql_select_db($db);
echo mysql_error();
phpinfo();
?>

I get these:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (13) in /Library/WebServer/testpad/test.php on line 3

Warning: mysql_select_db(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /Library/WebServer/testpad/test.php on line 3

Warning: mysql_select_db(): A link to the server could not be established in /Library/WebServer/testpad/test.php on line 3 Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Checking mysqladmin shows this var/mysql/mysql.sock.


also, i think it's possible that you'll need a leading slash in front of var/mysql/mysql.sock in mysqladmin.

/var/mysql/mysql.sock

so that it definitely matches what you've got in your mysql_connect() call.

speaking of which, there are several interesting notes on this subject on the mysql_connect() page on the php site:

http://us3.php.net/manual/en/function.mysql-connect.php

but, my guess is that the missing leading slash in the socket path in mysqladmin is placing the sock file in some weird place that php won't find. also, make sure there's a mysql directory in /var of course.


- philip









--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to