Windows Vista and later support IPv6 by default and Apache is often configured to bind to IPv6 if it can. However, pretty much all emulators only support IPv4.
When you access
http://localhost then Windows will resolve localhost as IPv6 to "::1". When the client then connects to the emulator on localhost Windows resolves as IPv4 to "127.0.0.1". The emulator then compares the IP it is connecting from (127.0.0.1) and the IP in the database (::1) and terminates the connection as they don't match.
By using
http://127.0.0.1 you skip Windows resolving localhost and so the database contains "127.0.0.1" meaning they match and the connection is authenticated.