Apache can't connect with mysql throug /var/run/mysqld/mysqld.sock and sends
this error message:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
Cannnot connect to DB server
Steps to Reproduce:
No real info here, first of all I'm missing why should apache itself try to
connect to mysql. Describe your problem better and reopen then.
This bug is caused by incorrect access permissions on /var/run/mysqld/
After running mysqld for the first time permission, ownership and group of this
drwxrwx--- 2 mysql root 4096 Nov 29 21:23 /var/run/mysqld/
It can be solved changing group to mysql
drwxr-x--- 2 mysql mysql 4096 Nov 29 21:23 mysqld/
and adding apache user at mysql group in /etc/group
(apache must be restarted after this).
I've explained bug and how to solve it.
Apache needs to connect with mysqld socket if a webpage uses a MySQL database.
Sorry, I forgot specify mysql version, it's mysql-4.1.14
Your permissions are incorrent.
# ls -la /var/run/mysqld/
drwxr-xr-x 2 mysql mysql 136 Nov 25 14:19 .
drwxr-xr-x 7 root root 640 Nov 29 18:58 ..
-rw-r--r-- 1 mysql mysql 0 Nov 25 14:06 .keep
-rw-rw---- 1 mysql mysql 6 Nov 25 14:19 mysqld.pid
srwxrwxrwx 1 mysql mysql 0 Nov 25 14:19 mysqld.sock
I know they are incorrect, but it's mine, mysql did it when I started it _the
(In reply to comment #6)
> I know they are incorrect, but it's mine, mysql did it when I started it _the
> first time_
No, it did not. See the ebuild:
chown -R mysql:mysql \