PHP-Mysql Socket Problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello frends!

   I want to connect with mysql  using php.

In my mysql "my.cnf" file i have specified the socket for both client
and server as

In my "php.ini" file, for mysql socket i have specified

/usr/local/mysql/var/mysql.sock     as the default path.

But i can't able connect with database. it shows DB connection failed.

My phpinfo() gives the following two lines for mysql sock

MYSQL_SOCKET     /tmp/mysql.sock
mysql.default_socket    /usr/local/mysql/var/mysql.sock    /usr/local/mysql/var/mysql.sock

If i set the socket as /tmp/mysql.sock in "my.cnf" , I CAN ABLE TO

What is the difference between MYSQL_SOCKET and mysql.default_socket ?

Advanced thanks

Re: PHP-Mysql Socket Problem

Quoted text here. Click to load it

 MYSQL_SOCKET shown on phpinfo() appears to be the value specified in
"configure" via --with-mysql-sock.  

 It gets mapped onto the constant MYSQL_UNIX_ADDR, which is used in the mysql
module's phpinfo function.

 But after looking through the rest of the source of the mysql module (in
5.1.4) it doesn't appear to be used anywhere else - only the configuration
option mysql.default_socket seems to be accessed, so it's that one you've got
to set.

Andy Hassall :: :: :: disk and FTP usage analysis tool

Re: PHP-Mysql Socket Problem

Andy Hassall wrote:

Quoted text here. Click to load it

Thanks for ur clarification Andy...but,

If i set the default socket as "/usr/local/mysql/var/mysql.sock"
 in php.ini
/etc/my.cnf ,

i can't able to connect.

it only works if i set /tmp/mysql.sock in both place.

what is the reason?


Site Timeline