By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

PHP-Mysql Socket Problem

P: n/a
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
"/usr/local/mysql/var/mysql.sock"

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
CONNECT.

What is the difference between MYSQL_SOCKET and mysql.default_socket ?

Advanced thanks
Bala

Jul 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 7 Jul 2006 10:16:20 -0700, "balavignesh" <kb**********@gmail.comwrote:
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
"/usr/local/mysql/var/mysql.sock"

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
CONNECT.

What is the difference between MYSQL_SOCKET and mysql.default_socket ?
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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jul 7 '06 #2

P: n/a

Andy Hassall wrote:
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.
Thanks for ur clarification Andy...but,

If i set the default socket as "/usr/local/mysql/var/mysql.sock"
in php.ini
and
/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?

regards
Bala

Jul 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.