5

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?

andrewtweber
  • 449
  • 1
  • 10
  • 18

1 Answers1

8

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.

jeff
  • 3,106
  • 1
  • 20
  • 10
  • 1
    That did it, thanks for explaining the difference between client/server and also showing me how to search for mysql-related packages! – andrewtweber May 14 '12 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 '19 at 14:56