?
Solved

MySQL cannot connect to local MySQL server, why?

Posted on 2006-04-10
7
Medium Priority
?
392 Views
Last Modified: 2010-05-18
Hi All,

My first foray into the land of MySQL and Linux initially looked ok but after a reboot of my machine I am now getting the following.

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

It's mysql  Ver 11.18 Distrib 3.23.58, for redhat-linux-gnu (i386)
0
Comment
Question by:VincentLawlor
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:tdterry
ID: 16417553
Your server probably isn't running automatically on boot.  

Check "ps ax | grep mysqld" to see if it's running.
To start MySQL, run "/etc/init.d/mysqld start" or "/etc/init.d/mysql start"

Adding MySQL to the boot script varies by Linux distribution.  For RedHat, use:
  chkconfig --add mysqld
  chkconfig mysqld on
0
 
LVL 4

Author Comment

by:VincentLawlor
ID: 16424833
Hi I have tried what you have suggested and here is what I get:

for ps ax | grep mysqld I get:
    8586    pts/2    R    0:00 grep mysqld
for ps ax | grep mysql i get:
    8591    pts/2    R    0:00 grep mysql

for "/etc/init.d/mysqld start" or "/etc/init.d/mysql start" I get:
    no such file or directory

for  chkconfig --add mysqld
    chkconfig: command not found

0
 
LVL 5

Expert Comment

by:tdterry
ID: 16426281
Your ps should show something like:

 7824 ?        S      0:00 /bin/sh /usr/bin/safe_mysqld --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid
 7853 ?        Sl     8:25 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking

There should be something in /etc/init.d/ related to mysql, database, or something.  chkconfig lives at /sbin/chkconfig.  You have to be logged in as root, of course.  If you're using "su" to get root permissions, make sure you use "su -".  The '-' creates a login-type shell with the correct paths for the root user and utilities.

I just noticed that your MySQL version says for "redhat-linux-gnu", so I assumed you were using RedHat.  What linux Distribution are you using?  What version?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 4

Author Comment

by:VincentLawlor
ID: 16426995
I am using RedHat Enterprise Release 2.4.21-4.EL

Nothing in /etc/init.d/ related to mysql

ps has the same result if I log in as root using "su -" but chkconfig runs
0
 
LVL 4

Author Comment

by:VincentLawlor
ID: 16451943
Problem solved by uninstalling the MySQL packages and re-installing the rpms.
Looked like the daemon was missing.

Can I have this one closed and points refunded. Problem solved.
Thanks.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16727505
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 9 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question