Subject: Re: PDO_MYSQL connect fallback from localhost do
/tmp/mysql.sock - msg#00019
Hello,
On 11/8/06, Andreas Korthaus <akorthaus@xxxxxx> wrote:
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?
It is not a bug, update your php.ini or use:
PDO("mysql:dbname=test;unix_socket=/var/run/mysqld/mysqld.sock");
--Pierre
Thread at a glance:
Previous Message by Date:
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
Next Message by Date:
Re: PDO_MYSQL connect fallback from localhost do /tmp/mysql.sock
Pierre wrote:
It is not a bug, update your php.ini
As said, there is no php.ini loaded (AFAIK). There is no php.ini at the
path phpinfo() shows.
or use:
PDO("mysql:dbname=test;unix_socket=/var/run/mysqld/mysqld.sock");
I know that, but what I would like to know is why PDO_MYSQL does not
connect to the MySQL-Server using TCP/IP (localhost:3306), as I
specified, but instead uses a socket-adress which seems to be compiled
into the mysql library.
best regards
Andreas
Previous Message by Thread:
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
Next Message by Thread:
Re: PDO_MYSQL connect fallback from localhost do /tmp/mysql.sock
Pierre wrote:
It is not a bug, update your php.ini
As said, there is no php.ini loaded (AFAIK). There is no php.ini at the
path phpinfo() shows.
or use:
PDO("mysql:dbname=test;unix_socket=/var/run/mysqld/mysqld.sock");
I know that, but what I would like to know is why PDO_MYSQL does not
connect to the MySQL-Server using TCP/IP (localhost:3306), as I
specified, but instead uses a socket-adress which seems to be compiled
into the mysql library.
best regards
Andreas