RE: PHP5-MySQL Not Connecting Through Socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Comment out the bind-address this allows mysqld to bind to all IPs;
accordingly determine if you only want it local or externally available.
Finally attempt to connect to the mysql server using the 
mysql -h127.0.0.1 -u<username> -p 
mysql -h<publicIP> -u<username> -p 
mysql -hlocalhost -u<username> -p

you may find the user permissions are the problem. Even when you connect
locally mysql sees these as connections the user is not allowed to
connect from.

Robert Allen, zce
Operations, FIO Labs, LLC

-----Original Message-----
From: Evan J [mailto:maps.this.address@xxxxxxxxx] 
Sent: Tuesday, August 30, 2005 11:41 AM
To: php-db@xxxxxxxxxxxxx
Subject: Re:  RE: PHP5-MySQL Not Connecting Through Socket

Thank you Robert for the prompt response. 

1) Yes, I do have /etc/my.cnf (644 permission)

2) I do have a bind-address directive but it was set to "127.0.0.0" by
default. I even changed it to "127.0.0.1" and restarted MySQL; no
luck.

3) my.cnf's socket file path and name in both [client] and [mysqld]
are the same and have been set accordingly.

I am still stumped as of why PHP cannot connect through Unix socket to
MySQL!

On 8/30/05, Bob Allen <zircote@xxxxxxxxxxxxxxx> wrote:
> 1) Do you have a /etc/my.cnf ?
> 2) In this do you have the bind-address directive set?
>  i.e. [ bind-address = 127.0.0.1        ] this is the default for
debian
> packages versions.
> 3) Also confirm the my.cnf reflects the mysql.sock path properly as
> well.
> 
> Robert Allen, zce
> Operations, FIO Labs LLC
> 
> 
> -----Original Message-----
> From: Evan J [mailto:maps.this.address@xxxxxxxxx]
> Sent: Tuesday, August 30, 2005 7:57 AM
> To: php-db@xxxxxxxxxxxxx
> Subject: PHP5-MySQL Not Connecting Through Socket
> 
> Hi,
> 
> I am running PHP 5.0.4 and MySQL 4.1.3a. (+Apache 2.0.54) When I run a
> PHP script that attempts to connect to MySQL I get the following
> error:
> 
> Database ERROR:Can't connect to local MySQL server through socket
> '/usr/local/mysql/tmp/mysql.sock' (13)
> 
> I have placed my socket file on such location when I was configuring
> MySQL and PHP was compiled with
> --with-mysql-sock=/usr/local/mysql/tmp/mysql.sock (and even with
> /usr/local/mysql/tmp). I even edited my php.ini
> (/usr/local/php/lib/php.ini, I have installed PHP with
> --prefix=/usr/local/php) and modified variable:
> 
> mysql.default_socket = "/usr/local/mysql/tmp/mysql.sock"
> 
> It still refuses to connect through the socket! I have also run a
> simple mysql_connect() script to see if the intended script was the
> culprit but again, it could not connect to MySQL.
> 
> phpinfo() indicates the following:
> 
> MYSQL_SOCKET    /usr/local/mysql/tmp/mysql.sock
> MYSQL_INCLUDE   -I/usr/local/mysql/include/mysql
> MYSQL_LIBS      -L/usr/local/mysql/lib/mysql -lmysqlclient
> 
> And for directives:
> mysql.default_port      no value        no value
> mysql.default_socket    /usr/local/mysql/tmp/mysql.sock
> /usr/local/mysql/tmp/mysql.sock
> 
> That being said, I "CAN" connect to the database via "127.0.0.1"
> through TCP/IP but not through Unix Socket file. The permissions on
> mysql.sock is:
> 
> ls -la /usr/local/mysql/tmp/
> total 0
> drwxrwx---   2 mysql mysql  80 2005-08-24 22:09 ./
> drwxr-xr-x  13 root  mysql 328 2005-08-22 20:03 ../
> srwxrwxrwx   1 mysql mysql   0 2005-08-24 22:09 mysql.sock=
> 
> Again, I can connect to DB through other programs (non-php) or via
> commandline and even TCP but not through Unix socket file!!
> 
> Any ideas?
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux