I've created a virtual machine and am installing things from scratch. Definitely not a sys admin so I'm running into some trouble. I've installed these packages and then restarted httpd

yum -y install mysql
yum -y install php-mysql
yum -y install mysql-devel
service httpd restart

The httpd restart is successful yet I am still getting this error:

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

I looked at /etc/my.cnf and indeed, socket is pointing to that path.

But the /var/lib/mysql folder does not even exist, nor do some files which seem crucial such as /etc/init.d/mysql. Am I missing some other important MySQL yum package? Why would some files (such as my.cnf) exist while others don't?

1 Answer 1


It's likely that you need to install the mysql-server package.

yum install mysql-server

You can search for packages by name with some of the following yum commands:

# list all packages starting with "mysql"
yum list mysql\*

# search package names/summaries/descriptions for "mysql"
yum search mysql

The packages which you did install likely provided only the client and client libraries, which you could use to connect to a mysql server located on another host.

  • 1
    That did it, thanks for explaining the difference between client/server and also showing me how to search for mysql-related packages! May 14, 2012 at 13:27
  • Same issue now I am faceing, but one thing, that I didnt know that what packages are installed in Linux server. So just I ran your command and the results are 1. List: Error: No matching Packages to list and 2. Search: Warning: No matches found for: mysql No Matches found... How can I found that where was Mysql installed on Linux machine..?
    – Pugal
    Sep 27, 2019 at 14:56

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.