LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-27-2005, 11:14 PM   #1
lumba
Member
 
Registered: Dec 2004
Location: USA
Distribution: redhat9
Posts: 53

Rep: Reputation: 15
mysql.sock doesn't exist


Hi:

I downloaded FC3 and MYSQL. When I tried to start MYSQL, I get the popular error message:

ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

The problem is mysql.sock doesn't exist anywhere. I checked
/tmp/mysql.sock
/var/lib/mysql/mysql.sock
find / -name mysql.sock

I couldn't find mysql.sock on my system . I appreciate any suggestions
 
Old 07-27-2005, 11:35 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
What do your logs tell you? mysql.sock is started and created when mysql is started. Do both your /var/lib and /var/run have the correct permissions and ownerships, which should be the mysql user? My guess would be that you need to do:

chown -R mysql.mysql /var/lib/mysql
 
Old 07-28-2005, 12:08 AM   #3
rohit-sk
LQ Newbie
 
Registered: Jul 2005
Location: INDIA
Posts: 12

Rep: Reputation: 0
hai

this is one of the great problems in mysql

if u are working in redhat then u have to start the mysql using " service mysqld start" from the root and then
type mysql.
 
Old 07-28-2005, 12:11 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Re: hai

Quote:
Originally posted by rohit-sk
this is one of the great problems in mysql

if u are working in redhat then u have to start the mysql using " service mysqld start" from the root and then
type mysql.
Ok so did that fix your problem? I'm confused by your response. I'm well aware of how Redhat works and operates to start services.
 
Old 07-28-2005, 12:52 AM   #5
lumba
Member
 
Registered: Dec 2004
Location: USA
Distribution: redhat9
Posts: 53

Original Poster
Rep: Reputation: 15
It's not ownership issue, I logged in as root.

This is what I get when I try service mysqld service.
mysqld: unrecognized service

Once I had simillar issue in Mandrake and I started mysql using
service mysql start, but it didn't work here.
The issue here is that mysql.sock doesn't exist. How would mysql know how to connect? I am missing something.
 
Old 07-28-2005, 03:57 AM   #6
fuelinjection
Member
 
Registered: Nov 2003
Location: County Durham, England
Distribution: Fedora
Posts: 238

Rep: Reputation: 30
mysql.sock is a file thats created by MYSQL when MYSQL starts up.

I believe that if mysql is running and the file hasnt been created, then its because MYSQL doesnt have the permissions on the folder to create the file.

I use Fedora 3, and I had to do the following :

# chown -R mysql /var/lib/mysql
# chgrp -R mysql /var/lib/mysql

This changes the ownership and the group of the /var/lib/mysql folder so that the account that mysql uses has the correct permissions on the folder to create the file. Then things like phpmyadmin and php use the sock file to establish a connection to mysql.

Did you install mysql yourself?

Did you enter this command...
# /usr/bin/mysql_install_db

To start mysql you could also try the following command

# /usr/bin/mysqld_safe --user=mysql &

I did a tutorial for Fedora 3 which you may like to take a look at, it might help you a little seeing as Fedora is Redhat(in a way).

http://www.linuxquestions.org/questi...hreadid=343061

Last edited by fuelinjection; 07-28-2005 at 03:58 AM.
 
Old 07-28-2005, 11:59 PM   #7
lumba
Member
 
Registered: Dec 2004
Location: USA
Distribution: redhat9
Posts: 53

Original Poster
Rep: Reputation: 15
Thanks a lot fuelinjection.
you solved my problem and I will go through your tutorial.
 
Old 07-29-2005, 05:49 AM   #8
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by lumba
Thanks a lot fuelinjection.
you solved my problem and I will go through your tutorial.
Funny how fuelinjection mentions to do this:

# chown -R mysql /var/lib/mysql
# chgrp -R mysql /var/lib/mysql

When I mention the same steps by telling you to do this which changes both user and group, notice the mysql.mysql:

chown -R mysql.mysql /var/lib/mysql

Though forgot to ask if you had actually installed a DB but it seemed you ignored my first reply anyhow..
 
Old 07-30-2005, 02:18 AM   #9
lumba
Member
 
Registered: Dec 2004
Location: USA
Distribution: redhat9
Posts: 53

Original Poster
Rep: Reputation: 15
Hi:

fuelinjection advised about the command /usr/bin/mysql_install_db. In it, I found the command /usr/bin/safe_mysqld & which started mysql daemon. It wasn't the ownership change that made it.
Of course I appreciate all responses and efforts from all users regardless of the results.
 
Old 07-30-2005, 11:16 AM   #10
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by lumba
Hi:

fuelinjection advised about the command /usr/bin/mysql_install_db. In it, I found the command /usr/bin/safe_mysqld & which started mysql daemon. It wasn't the ownership change that made it.
Of course I appreciate all responses and efforts from all users regardless of the results.
Your actual /sbin/service mysqld start should actually use the /usr/bin/safe_mysqld command but I simply overlooked and assumed you had already installed the default database before trying to start a database application..
 
  


Reply



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 On
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 07:19 AM
Problems with MySQL on SuSE: Can't Connect (/var/lib/mysql/mysql.sock) neocookie Linux - Software 8 02-07-2008 11:48 PM
can't connect to mysql through socket '/tmp/mysql.sock' Boby Programming 2 05-23-2004 01:32 PM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 09:46 AM
mysql.sock doesnt exist radix Slackware 1 10-26-2003 06:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:57 AM.

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
Open Source Consulting | Domain Registration