Monday, February 15, 2010

Remote MySql connection

Hi folks, in project you may need to connect to remote database server. To connect remote mysql server, you have to follow some steps:

Creating User: CREATE USER testuser IDENTIFIED BY 'testuser';

Grant access: GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON test.* TO 'testuser';

You need to open firewall port to access mysql server,on which your mysql server is running bydefault it takes 3306.

1) On Windows : controlpanel->Windows Firewall >Exceptions ->Add Port
2) On Ubuntu use command: sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 3306 -j ACCEPT

Connect to remote db by : mysql --host=remoteserverip -u testuser -p testuser

No comments:

Post a Comment