-1

I have to modify my site's database tables but when I run 'phpMyAdmin' (I'm using Xampp on my Windows Vista development laptop btw) I get

Error MySQL said: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) Connection for controluser as defined in your configuration failed.

So in reading here on SO I changed the file c:\xampp\phpMyAdmin\config_inc.php, the line of code

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

was changed to

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

and I need to have my sockets connection working for the database, I read here
that it means I'm only using tcp/ip and not sockets but my site worked FINE using sockets before.

So I shut down my 'Norton Security Suite' in an attempt to stop a firewall protection issue from causing this problem and restarted using 'localhost' but get the same error.

What can I do to revert back to using 'localhost'?

Community
  • 1
  • 1
wantTheBest
  • 1,682
  • 4
  • 43
  • 69
  • 'localhost' and '127.0.0.1' mean exactly the same thing, so changing them does not make any difference. – Qqwy Nov 29 '11 at 12:21
  • "Are you connecting to "localhost" or "127.0.0.1" ? I noticed that when you connect to "localhost" the socket connector is used, but when you connect to "127.0.0.1" the TCP/IP connector is used. You could try using "127.0.0.1" if the socket connector is not enabled/working." This is what another answer on SO said (click on my 'here' in my question to see that question) -- it may be resolving to the same localhost but if my sockets layer is hosed I need to fix that. – wantTheBest Nov 29 '11 at 12:24
  • @qqwy: I'm not sure if it's a Windows version thing, or a PHP version thing, or a Windows / PHP combination thing, but there is definitely a 'line in the sand' where 'localhost' was 'binding' to the IPv6 IP address, and not 127.0.0.1. That would explain why 127.0.0.1 works, and localhost doesn't. I'm not sure about the sockets comment though. – Narcissus Nov 29 '11 at 12:27
  • @Narcissus : I'm getting curious about how localhost/127.0.0.1 is really working now. I might ask a question about this ^.^ – Qqwy Nov 29 '11 at 12:38
  • As commented by OP below, the name resolution of "localhost" might be broken, this affects mySql and the user "pma" that is allowed from "localhost" only. No "localhost" lookup - no connect. – Stephan B Nov 29 '11 at 13:59
  • @qqwy: mysql's drivers special-case 'localhost' to use a local unix-domain socket file. Specifying '127.0.0.1' uses a TCP socket. It's an optimization thing, as local sockets are faster than tcp. – Marc B Nov 29 '11 at 20:39

2 Answers2

0

There is no problem with your host value, but the ['controluser'] that phpMyAdmin uses hat no access to your db. See phpMyAdmin docs

You can also remove the need for the controluser at all by using authtype = 'config': more docs

Stephan B
  • 3,671
  • 20
  • 33
  • actually pma is the default 'controluser' that got established at xampp/phpMyAdmin install time inside my config.inc.php and that hasn't changed. This is some sort of corruption problem I'm suspecting as I should not need to make any changes to config.inc.php like this -- switching from 'localhost' to '127.0.0.1' is a bandaid and I'm concerned I have a corrupted database -- the config files are all default values and previously worked fine. – wantTheBest Nov 29 '11 at 12:47
  • I think the bottom line is this: I should be able to enter http://localhost/phpmyadmin -- right now I can only use http://127.0.0.1/phpmyadmin -- so the reality is, 'localhost' is not resolving at all, meaning -- what -- an Apache problem? Or is it a tcp/ip sockets issue? – wantTheBest Nov 29 '11 at 13:08
  • to put a finer point on this -- typing localhost/phpmyadmin works FINE in Windows IE version 9.0.8112 but fails to resolve in Firefox 8.0. I'm not sure how that helps me but if anyone sees something here let me know -- I'm thinking about re-installing xampp (apache web server, phpmyadmin, everything) out of concerns that something is corrupted somewhere. – wantTheBest Nov 29 '11 at 13:20
  • 1
    The problem might be a bad hosts file, a proxy that tries to connect to its own http or a IPv6 name that messes with your localhost. Start with your hosts file in `%WINDIR%\system32\drivers\etc` - please post all entries with localhost or 127.0.0.1 or ::1 – Stephan B Nov 29 '11 at 13:57
  • I checked windows\system32\drivers\etc and found this in hosts: 127.0.0.1 localhost and ::1 localhost -- not sure about the ::1 but at least the file exists and is readable. – wantTheBest Nov 29 '11 at 16:58
0

I have to say here one of the most disquieting things has occurred -- the generally feared event "I didn't change anything it just started working."

For posterity let me outline how I 'fixed' this problem. But before I do that, let me describe the direction of my suspicion and the original problem:

PROBLEM -> localhost/myphpadmin was failing to resolve when typed into the browser, but 127.0.0.1/phpmyadmin worked OK. I needed to use phpMyAdmin to work with one of my web site's database. When I clicked on 'Admin' next to my Apache start/stop button on the Xampp control panel, the 'Xampp for Windows' appeared in the browser just fine, but clicking on 'phpMyAdmin' under 'Tools' on that page led to the error message i mentioned above. However if I typed 127.0.0.1/phpmyadmin in any browser window, phpMyAdmin started up fine.

Since MySQL 'listens' on Port 3306 (for you Xampp users, you will see this when you press the 'Start' button next to MySQL on the Xampp Control Panel), and since using the 'localhost/phpMyAdmin' name should resolve to a connection on that port, I wondered if my 'localhost' name resolution was the problem, since MySQL was successfully starting on that port as I could see in the Xampp Control Panel Application. Starting phpMyAdmin off of localhost should have succeeded -- MySQL was running. So it was seemingly not an issue with, say, another program 'stealing' port 3306 ahead of MySQL-- adding 'phpmyadmin' to 'localhost' was not the problem as MySQL had successfully started.

To investigate where the resolving of 'localhost' to a connection I followed the advice given to check my HOSTS file at c:\windows\system32\drivers\etc and found the entries in my comment above in the HOSTS file ("127.0.0.1 localhost" and "::1 localhost"). Nothing to see here, the HOSTS file was in fact present and looked fine.

I then altered the file c:\xampp\phpMyAdmin\config.inc.php, to change the line of code

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

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

and that band-aid allowed me to run phpMyAdmin but did NOT explain why localhost/phpMyAdmin would not resolve successfully and I yearned to change this config.inc.php back to 'localhost' and not '127.0.0.1'. (This morning I did just that).

I also navigated to the PhpMyAdmin home page site by clicking "Official Homepage" on the lower-right side of the window of PhpMyAdmin to see if there was a 'known issue' and found nothing.

One suggestion was ("maybe a firewall blocking mysql port") at The server is not responding (or the local MySQL server's socket is not correctly configured)

So I stopped my firewall temporarily (Norton Security Suite) -- no change.

Throughout the above process I restarted my computer whenever I changed something. So at around midnight I gave up and went to sleep.

And now, as if by magic, this morning I can now start the MySQL service from the Xampp control panel then clicking 'Admin' next to the Apache start/stop and selecting 'myPhpAdmin' link on the Xampp For Windows screen suddenly works fine. As you'll see in my description above, I changed nothing permanently -- I only stopped my firewall for a few minutes and made a temporary change to the 'host' entry in \xampp\phpMyAdmin\config.inc.php -- and this morning, with the firewall back up and the temporary change to 'host' being restored to 'localhost' in config.inc.php -- all is well. Very disquieting. While you can dust off an electrical connection and fix things, the bit of 'dusting' I did above changed nothing that I'm aware of. I can now type localhost/myphpadmin in both Firefox and IE and phpmyadmin successfully launches, so I can work on my site's database.

If anyone has any ideas what sort of 'dusting off' above achieved I'd like to know, I don't like spurious problems that are 'fixed' like this.

Community
  • 1
  • 1
wantTheBest
  • 1,682
  • 4
  • 43
  • 69