by default mysql server binds to 127.0.0.1, which means it only listens to localhost.
In the case of the app server is on a different box from the one mysql server resides, to make the application be able to create connections to the mysql server, first
change the /etc/mysql/my.cnf and bind to 0.0.0.0 or the particular IP
then when creating the database user, use sql like below
set storage_engine = InnoDB;
create database test_owner;
—grant ALL PRIVILEGES ON test_owner.* to test_user@’localhost’ IDENTIFIED by ‘xxxxx’;
grant ALL PRIVILEGES ON test_owner.* to test_user@’%’ IDENTIFIED by ‘xxxxx’;
this allows the user test_user to access the mysql server “test_owner” database from any hosts.