Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having some trouble with reinstalling MySQL, since i uninstalled it. I have been unable to install it again.

yum install mysql-server
yum install mysql

But what ever I do, the folder /var/lib/mysql is not having any files in it. When I do the command


I get this message: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)" I don't know what to do, what can I do to get the folder reappearing?

share|improve this question
What version of MySQL ??? – RolandoMySQLDBA Jan 28 '13 at 18:35
And, what version of CentOS ??? – Stefan Lasiewski Jan 28 '13 at 21:44

/var/lib/mysql is populated when mysqld is first started. Installing a package with yum doesn't automatically start mysqld.

/etc/init.d/mysqld start
chkconfig mysqld on

If I'm all wrong about this and you already tried to start mysqld, post mysqld.log please.

share|improve this answer
Fixed, thanks Michael – Dennis Kaarsemaker Jan 28 '13 at 21:19


MySQL is usually autostarted upon RPM installation. As of MySQL 5.5.8, that is no longer the case.


When you run an RPM install, the service is called /etc/init.d/mysql. Since you ran a yum install, the service is called /etc/init.d/mysqld.


Please run this:

MYSQL_SERVICE_NAME=`chkconfig --list | grep -i ^mysql | awk '{print $1}'`

Then, try running

service ${MYSQL_SERVICE_NAME} start

and see if mysql starts up

Sorry if this seems like overkill. You will only need to do this once. Whatever MYSQL_SERVICE_NAME is, that's the service name you should always use.

share|improve this answer
Wow, overkill. :) – Michael Hampton Jan 28 '13 at 21:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.