Xampp 1.7.4 on XP-SP3.
I have had the same problem as the OP - error 2002 after clicking phpMyAdmin link on Xampp's welcome page (
http://localhost/xampp/).
However I only get error 2002 when the PC is disconnected from the network via network connections in control panel (start/control panel/network connections/connection-name/right-click/disable). With the connection enabled phpMyAdmin works just fine.
The problem was resolved as soon as I put a "bind-address=127.0.0.1" configuration parameter in the [mysqld] section of the "my.ini" configuration file (<xampp-install-folder>\mysql\bin\my.ini) and restarted MySQL on the Xampp control panel. Now phpMyAdmin works whether the PC is connected to its local network or not.
Some useful resources I found while investigating this were:
Microsoft TCP/IP Fundamentals for Microsoft WindowsVista, XP, Server 2003, 2008 as a PDF, 4MB download
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=8781online technet pages
http://technet.microsoft.com/en-us/library/hh182191.aspxChapter 7 - Host Name Resolution
http://technet.microsoft.com/en-us/library/bb727005.aspxChapter 16 – Troubleshooting TCP/IP
http://technet.microsoft.com/en-us/library/bb727023.aspxDiagnosing error codes given by MySQL clients when they fail to connect to MySQL server Windows Sockets Error Codes
http://msdn.microsoft.com/en-us/library/ms740668%28v=vs.85%29.aspx(for me, phpMyAdmin failed with WSAECONNREFUSED 10061 - Connection refused)
MySQL 5.5 Reference Manual C.5.2.2. Can't connect to [local] MySQL server
http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html7.11.5.2. How MySQL Uses DNS
http://dev.mysql.com/doc/refman/5.5/en/dns.html5.1.2. Server Command Options
http://dev.mysql.com/doc/refman/5.5/en/server-options.html5.1.2. bind-address=
http://dev.mysql.com/doc/refman/5.5/en/server-options.html#option_mysqld_bind-addressCouple of Techniques to see error codes generated by failure to connect1) start a command prompt (start/run/cmd.exe)
ensure MySQL has been started (xampp control panel)
cd <xampp-install-folder>\mysql\bin
mysql
If the command-line mysql client can connect to the MySQL server you'll get a "mysql >" prompt
mysql> status
mysql> exit
If the command-line mysql client fails to connect to the MySQL server you'll get an error message.
I was getting:
"ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)"
2) copy <xampp-install-folder>\htdocs\xampp\mysql.php <xampp-install-folder>\htdocs\xampp\mysqldbg.php
edit <xampp-install-folder>\htdocs\xampp\mysqldbg.php
remove the '@' from in front of the 'mysql_connect'
save your change
ensure MySQL and Apache are started via the Xampp control panel
in your browser open the url "http://localhost/xampp/mysqldbg.php"
You'll get a page with just "OK" on it if there's a connection to MySQL
You'll get the full error message and "NOK" if no connection can be made.
(The "@" suppresses warnings and errors on the PHP function call, removing the "@" lets you see them if they occur)
I was getting:
"Warning: mysql_connect() [function.mysql-connect]: [2002] No connection could be made because the target machine
actively (trying to connect via
tcp://localhost:3306) in <xampp-install-folder>\htdocs\xampp\mysqldbg.php on line 2
Warning: mysql_connect() [function.mysql-connect]: No connection could be made because the target machine actively
refused it. in <xampp-install-folder>\htdocs\xampp\mysqldbg.php on line 2
NOK"