Introduction

While accessing phpMyAdmin from WHM, you may encounter MySQL connection errors if the MySQL socket file is missing or incorrectly configured.


Prerequisites

  • Root or SSH access to the server
  • Access to WHM
  • Basic knowledge of MySQL configuration files

Implementation

Error Message

While accessing phpMyAdmin from WHM, the following error may appear:

#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)


Reason

The MySQL socket file is missing from the /tmp directory or the phpMyAdmin configuration is pointing to the wrong socket path.


Solution 1: Create a Symbolic Link for MySQL Socket

Create a symbolic link from the original MySQL socket file to the /tmp directory using the following command:

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock


Solution 2: Update phpMyAdmin Configuration

Edit the phpMyAdmin configuration file:

vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php


Locate the Following Configuration

$cfg[‘Servers’][$i][‘socket’] = ”;

Change it to:

$cfg[‘Servers’][$i][‘socket’] = ‘/var/lib/mysql/mysql.sock’;


Locate the Following Line

$cfg[‘Servers’][$i][‘connect_type’] = ‘tcp’;

Change it to:

$cfg[‘Servers’][$i][‘connect_type’] = ‘socket’;


Save the File

Save the configuration file and exit the editor.

After making these changes, try accessing phpMyAdmin again.


Conclusion

By correcting the MySQL socket configuration or creating the required symbolic link, you can resolve the phpMyAdmin #2002 connection error in WHM successfully.

Leave a Reply