Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

mysql

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
2  
What version of MySQL ??? –  RolandoMySQLDBA Jan 28 '13 at 18:35
    
And, what version of CentOS ??? –  Stefan Lasiewski Jan 28 '13 at 21:44
add comment

2 Answers

/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
add comment

OBSERVATION #1

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

OBSERVATION #2

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.

SUGGESTION

Please run this:

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

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
add comment

Your Answer

 
discard

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.