Could this be a problem with the firewall? Because I also hosted a game server and its works fine with the localhost. In fact, for I use the same database for the web and game server.
I also tried to create a new user...
mysql -u root -p
then it will ask for the root password