SQL #2002 Error Fix on Ubuntu 16.04

Feroz Ahmad bio photo By Feroz Ahmad Comment

#2002 PHPMYADMIN, aaargh! Finally Solved

I tried out all most each and every step on stackoverflow. Finally I was able to to debug the error. Well what does Error#2002 says, The server is not responding (or the local MySQL server’s socket is not correctly configured)

Some solutions suggested sytem reboot, clearing browser’s cache and bla bla. None of them seemed to work.

Finally, I realized that I installed an older version of MySQL 5.5 (for some Project), and MySQL server was running accepting connections via UNIX sockets and phpMyAdmin was trying to connect via TCP connections. So the solution was to specify UNIX sockets at phpMyAdmin end.

How to check what connection your MySQL server is accepting:

Login into MySQL via CLI using

mysql -u root -p

and then in MySQL terminal


gave output as

mysql  Ver 14.14 Distrib 5.5.54, for linux2.6 (x86_64) using readline 5.1

Connection id:		50
Current database:	
Current user:		[email protected]
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		5.5.54-log MySQL Community Server (GPL)
Protocol version:	10
Connection:		Localhost via UNIX socket
Server characterset:	latin1
Db     characterset:	latin1
Client characterset:	utf8
Conn.  characterset:	utf8
UNIX socket:		/tmp/mysql.sock
Uptime:			1 hour 52 min 49 sec

Now configue phpMyAdmin to connect via UNIX sockets :

Open phpmyadmin config file, which ‘should’ be at following location

sudo gedit /etc/phpmyadmin/config.inc.php

here you need to specify about the connection method, add following lines

$cfg['Servers'][$i]['connect_type'] = 'SOCKET';
$cfg['Servers'][$i]['port'] = '/tmp/mysql.sock';

Unfortunately this wasn’t enough, and I had to add some obvious thing

$cfg['Servers'][$i]['host'] = '';

And finally it worked.

comments powered by Disqus