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?


/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.



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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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