phpMyAdmin can't connect to local MySQL server through socket '/var/lib/myseql/mysql.sock'

sandhi asked:

I’m trying to get phpMyAdmin working, connecting locally to mysql from Centos 6.3 running in VMWare Player.

mysqladmin -u root -p status
indicates that mysql is running.

Both my.cnf and point to socket `/var/lib/mysql/mysql.sock“.

I’ve tried and localhost.0.0.1/phpMyAdmin.

In both cases I get the message:

#2002 - Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
The server is not responding (or the local server's socket is not correctly configured)

Can anyone tell me what else to check?

My answer:

You need to set the appropriate SELinux boolean to allow the web server to communicate with MySQL.

setsebool -P httpd_can_network_connect_db 1

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.