mysql server access from outside

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;
use 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’;
flush privileges;

this allows the user test_user to access the mysql server “test_owner” database from any hosts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s