PhpMyAdmin Error 2002

This is an error seen when connecting to PhpMyAdmin via Cpanel.

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

Fix: Symbolically link /tmp/mysql.sock to /var/lib/mysql/mysql.sock

*Restart MySql services for changes to take effect.*

Or here’s an even easier fix:

To make your life easier, you can make a simple change to the MySQL configuration file /etc/my.cnf that will permanently set the socket file used by the mysql client. After making a backup copy of /etc/my.cnf, open it in your favorite editor. The file is divided into sections such as

[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/usr/local/mysql

If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:

[client]
socket=/var/lib/mysql/mysql.sock

If there is already a [client] section in the my.cnf file, add or edit the socket line as appropriate. You won’t need to restart your server or any other processes. Subsequent uses of the mysql client will use the proper socket file.

Leave a Reply

Your email address will not be published. Required fields are marked *