Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 113960 - apache can't connect with mysql throug /var/run/mysqld/mysqld.sock
Summary: apache can't connect with mysql throug /var/run/mysqld/mysqld.sock
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-29 16:27 UTC by Federico Moro
Modified: 2005-11-30 00:06 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Moro 2005-11-29 16:27:29 UTC
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
'/var/run/mysqld/mysqld.sock'
Cannnot connect to DB server

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-11-29 16:31:41 UTC
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.
Comment 2 Federico Moro 2005-11-29 16:42:38 UTC
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
path are:

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

mysql:x:60:apache

(apache must be restarted after this).
Comment 3 Federico Moro 2005-11-29 16:48:32 UTC
I've explained bug and how to solve it.
Apache needs to connect with mysqld socket if a webpage uses a MySQL database.
Comment 4 Federico Moro 2005-11-29 16:53:11 UTC
Sorry, I forgot specify mysql version, it's mysql-4.1.14
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-11-29 22:53:12 UTC
Your permissions are incorrent.

# ls -la /var/run/mysqld/
total 5
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

INVALID bug.
Comment 6 Federico Moro 2005-11-29 23:56:09 UTC
I know they are incorrect, but it's mine, mysql did it when I started it _the
first time_
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2005-11-30 00:06:01 UTC
(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:

<snip>
dodir "/var/run/mysqld"
keepdir "/var/run/mysqld"
chown -R mysql:mysql \
"${D}/var/run/mysqld"
</snip>

Closing.