logo       

PDO_MYSQL connect fallback from localhost do /tmp/mysql.sock: msg#00018

php.pecl.devel

Subject: PDO_MYSQL connect fallback from localhost do /tmp/mysql.sock

Hi!

I have a strange problem when connecting to a MySQL 4.0.24 server using PDO_MYSQL (from PHP 5.1.6).

I tried the following code:

<?php
new PDO('mysql:host=localhost;dbname=test');
?>

And the error is:

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

If I change the hostname to the external name:

<?php
new PDO('mysql:host=example.com;dbname=test');
?>

it works.

In my.cnf "socket" is set to /var/run/mysqld/mysqld.sock, not /tmp/mysql.sock.

There is no php.ini loaded, the precompiled mysql library from MySQL AB has been used.

In phpinfo() the setting "MYSQL_SOCKET" from the old mysql extension says /tmp/mysql.sock!

Do you have any idea what is going wrong here?
Should I file a bug report?


best regards
Andreas



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise