LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-14-2005, 10:20 PM   #1
mabus92920
Member
 
Registered: Jan 2005
Posts: 48

Rep: Reputation: 15
can't connect mysql.sock error


dude..I recently installed FC3 on my system. I activated httpd,and mysqld. when I tried to run my web application (which was done using php scripts)..it showed this "can't connect to mysql.sock" error..

when i tried to run phpinfo.ph (that only contains phpinfo(); ) it displayed the details properly, so I guess my php is working well.

this is a mysql problem right? how do I fix this ?

another thing..I didn't have this back then with RH9... and also, I got this error on a diferent system when I installed mysql, and I was able to fix it by turning down the firewall. This time, I didn't have to install mysql since I allready did it during intallation of the OS.

how do I fix this ? and what causes this problem?
 
Old 04-14-2005, 11:52 PM   #2
s_deepak_123
Member
 
Registered: Oct 2004
Location: Mysore, India
Distribution: Fedora Core 1, Xandros desktop OS 2
Posts: 54

Rep: Reputation: 15
su to root, type the following:
service mysqld start
That should fix it.
To start the service automatically, you have to enable mysqld in the system tools -> services
 
Old 04-15-2005, 12:16 AM   #3
duongvn
LQ Newbie
 
Registered: Apr 2005
Location: Kobe, Japan
Posts: 4

Rep: Reputation: 0
I think the problem here is that your mysql client cannot find the file mysql.sock
(default path is /tmp/mysql.sock).
Then, you should find this file in /var/lib/mysql/mysql.sock
You can also change the setting in file /etc/my.cnf to set the path to mysql.sock as well.
 
Old 04-15-2005, 08:44 AM   #4
sachins
LQ Newbie
 
Registered: Feb 2005
Posts: 3

Rep: Reputation: 0
Yes I also had the same problem last month. I searched for the file mysql.sock but it seems it is nowhere to be found in my system. I use FC3. Could anyone post out the mysql.sock contents so that i can make the file and put it in its right place.
 
Old 04-15-2005, 10:12 AM   #5
dylants
Member
 
Registered: Oct 2003
Location: Bath UK
Distribution: RedHat 7,9 RHEL 2.1-4 Suse 9.1, 9.2, Ubuntu, Centos 3-4, Fedora 3-5
Posts: 44

Rep: Reputation: 15
according to my system that is running mysql quite happily, mysql.sock is 0 bytes in size:

Code:
ls -l /var/lib/mysql/mysql.sock
srwxrwxrwx    1 mysql    mysql           0 Mar  2 10:40 /var/lib/mysql/mysql.sock
My mysql config file contains
Code:
cat /etc/my.conf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
...
when you start the service it should create this file.

service started by logging into root account and issuing:
Code:
service mysqld start
I am running RHEL3 - to make this service start when the machine boots I used:
Code:
# chkconfig mysqld on
confirmed with:
Code:
# chkconfig mysqld --list
mysqld          0:off   1:off   2:off   3:on    4:on    5:on    6:off
HTH

Dylan

Last edited by dylants; 04-15-2005 at 10:13 AM.
 
Old 04-15-2005, 11:04 PM   #6
pcweirdo
Member
 
Registered: Oct 2004
Location: Melbourne-ish, Australia
Distribution: Gentoo, Windows XP Pro
Posts: 58

Rep: Reputation: 15
You can't copy the contents of mysql.sock! It's a socket, not a normal file!
See the 's' at the start of:
"
srwxrwxrwx 1 mysql mysql 0 Mar 2 10:40 /var/lib/mysql/mysql.sock
"

If your php scripts specifiy the mysql hostname with something other than 'localhost', for example using the name '127.0.0.1', php will try to use TCP/IP. Then you don't have to worry about every setup putting mysql.sock in a different place.

However, in php.ini:
"
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =
"
Mine is blank, so it will use the built-in MySQL's defaults. You can change php.ini to have your actual socket in it. Everything works once you mess with the config files enough. You might try saving a backup before fiddling.

The main problem here is that the MySQL built into PHP has different settings to the MySQL server you have running.
 
Old 04-15-2005, 11:38 PM   #7
mabus92920
Member
 
Registered: Jan 2005
Posts: 48

Original Poster
Rep: Reputation: 15
I solved the problem allreday.. I forgot the permissions on /home directory, when I set it , then everything came to place.. It's probably the app that didn' t have the privilege on accessing some folders.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock welery Linux - Software 19 03-06-2014 08:19 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-08-2008 12:48 AM
Buzilla issue: "Can't connect to local MySQL server through socket '/tmp/mysql.sock'" vitopn Linux - General 3 05-21-2007 11:13 AM
can't connect to mysql through socket '/tmp/mysql.sock' Boby Programming 2 05-23-2004 02:32 PM
did anybody figure out mysql.sock error? needforspeed Linux - Software 5 02-21-2004 10:03 AM


All times are GMT -5. The time now is 09:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration