MySQL Forums
Forum List  »  General

Re: Can't connect to local DB using IP instead of localhost
Posted by: Rick James
Date: May 14, 2014 10:33AM

If the IP address of the _server_ (where mysqld is running) is 111.222.333.444, and the IP address of your _client_ (the other host) is 44.33.22.11, then you need to execute this on the _server_ through the commandline "mysql" tool (or other methods):
GRANT ALL ON *.* TO 'root'@'44.33.22.11' IDENTIFIED BY 'mypass'
and you make the connection via
getConnection("jdbc:mysql://111.222.333.444:3306/customers", "root", "mypass"); FAIL (my ip instead of 11...)

Security advisory: Do not grant "root" (or any other user) "ALL ON *.* TO ...@'%'", it makes it easy for hackers to get in and do nasty things.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.