MySQL cannot connect to local MySQL server, why?

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)
LVL 4
VincentLawlorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tdterryCommented:
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
VincentLawlorAuthor Commented:
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
tdterryCommented:
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
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

VincentLawlorAuthor Commented:
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
VincentLawlorAuthor Commented:
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
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.