|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can't connect to local MySQL server through socket
Hi,
I have installed MySQL server 3.23.58 on Redhat Fedora (latest release) and have problems accessing MySQL with PHP via localhost using the UNIX socket, and am getting the error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' I have been through all the previous posts relating to this error and cannot seem to fix it. The socket exists, is read/writable, and works via the command line mysqladmin -h localhost version It also works over the web using PHP, **IF** I use 127.0.0.1 instead of localhost (so connecting via TCPIP). I have tried editing php.ini referring mysql.default_socket to other locations (and setting up symlinks as necessary) but to no avail. Has anyone got any other ideas about where my setup could be misconfigured? Thanks in advance for any help! Jeff |
|
#2
|
|||
|
|||
|
Check the owner of the /var/lib/mysql/mysql.sock file to see if the user who run php/apache can access to it
|
|
#3
|
|||
|
|||
|
Yup the issue is permission related. Fedora core 3 is cool though with the minor hickup of upgrading to MySQL 4.latest may prove unnerving for some.
SELINUX (strict) can also hinder your php scripts. |
|
#4
|
|||
|
|||
|
Yes - I've tried it
I have tried both chmodding the mysql.sock file as 777, and changing group and owner permissions to apache, without any success. I'm still getting the same error message.
One thing I've noticed that must have a bearing on this, when the web request for the page containing the mysql query comes in (and returns the above error) the following appears on the Linux console: audit(1100961095.183:0): avc: denied {write} for pid=3651 exe=/usr/sbin/httpd name=mysql.sock dev=dm-0 ino=3048789 scontext=user_u:system_r:httpd_t tcontext=root bject_r:var_lib_t tclass=sock_fileI don't understand most of this, except that there is a write denied to httpd and mysql.sock is referred to, which does seem significant! The problem is that I have allowed all the permissions I can think of - what is left? Does this error message point to the REAL problem? Thanks again for any help you can provide! Jeff |
|
#5
|
|||
|
|||
|
-Thats SELINUX warning messages. Try disabling or setting it to warn. A reboot is required for any change to SELINUX.
-/var/lib/mysql needs to be owned recursively by mysql (the user running mysql) . |
|
#6
|
|||
|
|||
|
Great! Disabling selinux did the trick! Many thanks for your help.
Jeff |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Can't connect to local MySQL server through socket |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|