user7382013
user7382013

Reputation: 21

How to access another computer mysql database in my computer(which is 50km away)using java

My Friend needs to access my MySQL database remotely using his java program,he has completed all coding but wen we try to connect with IP and correct user name,password,i have disabled my firewall and enabled dmz in my router to open all ports,Still wen tries to communicate,its says communication link failure,there is no permission to access this mysql server.

This is the error:

java.sql.SQLException: null,  message from server: "Host 
            '45.123.3.250' is not allowed to connect to this MySQL server"

Upvotes: 0

Views: 387

Answers (1)

Jason Blue
Jason Blue

Reputation: 9

The error you received is indication that MySql is blocking the connection.

MySql by default will not allow one to connect from a remote machine. You must explicitly grant access for your friend to connect remotely.

Typically you would grant to a user@hostname, but you may substitute % for hostname. The downside of this is that it would open it up for anyone using the username (and the password you specify) to connect from anywhere, but eliminates the issues around dynamic IP addressing or NATed networks.

For more information see MySql documentation on access control and GRANT command.

Upvotes: 1

Related Questions