Portal Home > Knowledgebase > Articles Database > Users cannot connect to MySQL via phpmyadmin


Users cannot connect to MySQL via phpmyadmin




Posted by BrightStar, 08-17-2008, 12:08 PM
It seems I am having issues with WHM/CPanel. I cannot connect to mysql via phpmyadmin through WHM as a root and get this error #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) All users get the same error when they try to access mysql from cpanel. The access seems to be only for valid for 192.168.1.% Would allowing access to localhost will help and how can I do that for all users? Thanks

Posted by k3oni, 08-17-2008, 01:35 PM
Try and edit the following file and change a few values: /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php Change first $cfg['Servers'][$i]['host'] = 'localhost'; to $cfg['Servers'][$i]['host'] = '127.0.0.1'; Save file and restart mysql and see if phpmyadmin is now responding from cpanel. If not edit the file again: $cfg['Servers'][$i]['connect_type'] = 'tcp'; set it to $cfg['Servers'][$i]['connect_type'] = 'socket'; and add this line under the modified one: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock'; Make sure /tmp has 1777 permissions set. One of this two modifications should resolve your problem i believe.

Posted by BrightStar, 08-17-2008, 01:59 PM
You are an absolute star...the first thing made it work like a charm. Thank you so much

Posted by k3oni, 08-17-2008, 02:08 PM
Good to hear that, you may want to check that /etc/hosts file has also the localhost entry set correctly.

Posted by BrightStar, 08-17-2008, 04:54 PM
etc/hosts says 127.0.0.1 localhost Why isnt it working then?

Posted by tracerouteme, 08-17-2008, 09:35 PM
Make sure there is a link to mysql socket file in /tmp. If there is no link, you can create it using the command ln -s /var/lib/mysql/mysql.sock /tmp/

Posted by BrightStar, 08-18-2008, 02:38 PM
root@server [~]# ln -s /var/lib/mysql/mysql.sock /tmp/ ln: `/tmp//mysql.sock': File exists

Posted by k3oni, 08-18-2008, 03:47 PM
I have to say that it is kind of hard to say without checking on the server why phpmyadmin does not see/translate localhost to 127.0.0.1, there may be a few factors. Try and edit the localhost line in /etc/hosts to look like this: 127.0.0.1 localhost.localdomain localhost This not such a big problem if it is related only to phpmyadmin but you may want to check that other applications can access localhost and i am sure that they do(like a php script to connect to mysql using localhost as the server) .

Posted by dkitchen, 08-18-2008, 07:11 PM
This is a recent issue and I've seen it lots with cPanel/WHM in recent weeks and would appear to be the result of an update. I'm not sure if it's kernel related or cPanel related but basically the box seems to have problems seeing "localhost". Same issue occurs with webmail and various other apps that use localhost rather than 127.0.0.1...



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
MySQL Server (Views: 667)


Language: