Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a LAMP stack box (CentOS 6) and another CentOS 6 box running mysql server.

I've installed phpmyadmin on the LAMP box but I can not get it to talk to my SQL box at all.

I have configured the following in

/* Servers configuration */
$i = 0;

/* Server: usp-ggdb2 [1] */
$cfg['Servers'][$i]['verbose'] = 'usp-ggdb2';
$cfg['Servers'][$i]['host'] = '';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';

When I browse to the phpmyadmin site I get the following error:

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

I don't know why it is talking about trying to connect to a local server as I've configured just the one server (and it's remote).

If i tcpdump I can see that it makes no attempt to establish a connection to the IP i specified.

It's as if my config file is being ignored.

Is there a way to turn on some more debug information? Any and all suggestions welcome!

share|improve this question
A detail blog is here: – Suresh Kamrushi Sep 4 '14 at 6:30
up vote 2 down vote accepted

I have resolved the issue. Indeed, my config file was being ignored. I had been copying to in the top level directory of the website (/var/www/html/pma).

However, on CentOS 6 there is a separate config directory -- /etc/phpMyAdmin/. Once I copied my config there, everything works ok.

share|improve this answer

One of the standard settings found in RHEL 6 and CentOS 6 is SELinux defaults to enforcing mode. You can verify that with the getenforce command.

If in Enforcing mode the quickest way to verify if that SELinux is the culprit is often to temporarily disable SELinux with setenforce 0. If with SELinux disabled everything works as expected it's confirmed.

Return SELinux to enforcing mode with setenforce 1 and set the policy governing network based database access for web applications to allowed:

   setsebool -P httpd_can_network_connect_db 1

If the MySQL database is listening to a non-standard port that may be insufficient and you could try to allow the generic network policy:

  sesebool -P httpd_can_network_connect 1 
share|improve this answer
SELinux is disabled on both machines. I've created a simple test PHP page with a mysqli_connect statement and this works fine. It's as if my config file is being completely ignored. – wimnat May 4 '14 at 23:42

I ran into another reason you can get this error. You need to meet the following conditions

  1. Use the MySQL Native Driver for PHP (which is recommended)
  2. Use MySQL 5.6 or later
  3. Use a self-signed SSL certificate for MySQL communication

As described in this PHP bug, MySQLND will obey the preferences of MySQL and try to validate the SSL certificate. Since it can't (being self-signed) the connection simply fails with a 2002 error (nice and vague!)

As noted in the bug, PHP 5.6.16 (also present in 7.0+) added another connection option to mysqli_real_connect called MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT, which disables the validation of the SSL certificates on the MySQLND side. For versions prior to PMA 4.6.0 you will have to edit libraries/dbi/DBIMysqli.php and edit the line with

$client_flags |= MYSQLI_CLIENT_SSL;

And replace it with (ONLY FOR PHP 5.6.16 or later)


For PMA 4.6.0 or later you can simply set in the config

$cfg['Servers'][$i]['ssl_verify'] = false;
share|improve this answer

Your Answer


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.