Re: PHP5-MySQL Not Connecting Through Socket
| From: | Evan J | Date: | Fri, 02 Sep 2005 12:43:20 +0000 |
| Subject: | Re: PHP5-MySQL Not Connecting Through Socket | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40203@lists.php.net to get a copy of this message | ||
Ok, someone mentioned that I did not have an appropriate permission to
access mysql.sock directory. Guess what? He was right on the spot. So
for whomever who reads this, the solution proposed is to `chmod 755
/usr/local/mysql/tmp'
Thanks to that individual who assisted me on this.
On 9/2/05, Fen Lu <gojyo.akayi@gmail.com> wrote:
> how about change
> bind-address = 127.0.0.1
> to
> bind-address = your.real.ip.address
>
> may be it works.
> I got the same trouble a few days ago, but I forgot how I fixed it .. :-(
>
> some changes in my.cnf
>
> On 8/30/05, Evan J <maps.this.address@gmail.com> wrote:
> >
> > 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
> >
> >
>
>
>
> --
> From : Fen lu