I had the same problem. Here were my fixes:
1) My hosting service is 1and1. localhost is NEVER right with them – there’s a specific host name that looks something like dbNNNN.perfora.net. I figured that out but it still didn’t work.
2) My text editor had added the file extension txt to the end of wp-config. As soon as I edited the filename back to wp-config.php everything worked perfectly.
I hope this posting saves someone else the hour I wasted.