I fear there is no readily-available answer
remember if this was easy everybody would be experts and your qualification would mean ziltch.
Google for a solution. Here is a suggestion:
All you need to do is edit the following file if you have an admin rights
c:\windows\system32\drivers\etc\hosts // search for hosts - it may depend on your OS
Uncomment the line that says
127.0.0.1 localhost // i.e. remove the #
............................
I had this problem.
This is what it should look like if you're having problems:
$connect = mysql_connect('127.0.0.1','root',''
; // as against using "localhost"