Re: PHP5-MySQL Not Connecting Through Socket
| From: | Evan J | Date: | Sat, 03 Sep 2005 00:35:15 +0000 |
| Subject: | Re: PHP5-MySQL Not Connecting Through Socket | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-40210@lists.php.net to get a copy of this message | ||
No Fen Lu, as I said in my first post, MySQL runs just fine and for
some strange reason all other applications can connect through unix
socket to the database except PHP scripts. But I solved the problem
but chmod'ing the "directory" of the socket file rather the socket
file itself. It had slipped through my eyes; now everything works as
it's expected [CASE CLOSED].
On 9/2/05, Fen Lu <gojyo.akayi@gmail.com> wrote:
> try
> #: mysqld
> for test?
> I think your mysql is not running~...
> I met this problem last night...hehe...
>
> On 9/2/05, Evan J <maps.this.address@gmail.com> wrote:
> >
> > 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
> >
> > --
> > PHP Database Mailing List ( http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> From : Fen lu