But that doesn't mean that you gave the user permissions to connect from a server outside of the server that it is configured on.
Check the my.cnf bind-address.
Then grant the privilege.
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'@'1.2.3.4' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Make sure that you change:
- USERNAME to the actual DB users's username
- 1.2.3.4 to the actual IP of the MySQL server
- PASSWORD to the actual DB user's password
I would actually recommend that you add a second username/password combo for the external access and grant it access to the database.
Then test the connection.