MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2004, 07:24 AM
jeffwaldock jeffwaldock is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 jeffwaldock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old November 20th, 2004, 08:29 AM
omiossec omiossec is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Paris, France
Posts: 375 omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level)omiossec User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 16 h 4 m 46 sec
Reputation Power: 6
Send a message via ICQ to omiossec Send a message via AIM to omiossec
Check the owner of the /var/lib/mysql/mysql.sock file to see if the user who run php/apache can access to it
__________________
Olivier Miossec
http://www.lasso-developpeur.net

Reply With Quote
  #3  
Old November 20th, 2004, 08:40 AM
teki associates teki associates is offline
Retired
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 252 teki associates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 20 sec
Reputation Power: 5
Post

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.

Reply With Quote
  #4  
Old November 20th, 2004, 08:40 AM
jeffwaldock jeffwaldock is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 jeffwaldock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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=rootbject_r:var_lib_t tclass=sock_file

I 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

Reply With Quote
  #5  
Old November 20th, 2004, 08:56 AM
teki associates teki associates is offline
Retired
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 252 teki associates User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 20 sec
Reputation Power: 5
Post

-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) .

Reply With Quote
  #6  
Old November 20th, 2004, 09:13 AM
jeffwaldock jeffwaldock is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 jeffwaldock User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Great! Disabling selinux did the trick! Many thanks for your help.
Jeff

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Can't connect to local MySQL server through socket


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT