Just got a new lap top with Windows 7 and while reinstalling everything I had trouble installing WordPress. I couldn't find a solution that worked for me. Finally messing around I solved it. I know this won't solve everyone's problem but it may help some.
I followed all the directions to install WordPress into a testsite on wampserver2. But when I ran http://localhost/testsite/blog/wp-admin/install.php it said it couldn't connect to the database.
The database, user name and password were correct. They were correct in wp-config.php. The user had the correct privileges.
I went into the mysql console and listed the users and their privileges. I noticed that the two records for root had one host as 127.0.0.1 and the other localhost. But the user I created for wordpress had % as the host.
I went into phpMyAdmin and changed the host from % to localhost. Now the installation program for WordPress is working.
Hope this helps.