?
Solved

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

Posted on 2012-08-16
8
Medium Priority
?
3,426 Views
Last Modified: 2012-08-17
while doing any kind of crud operation on the java application i am getting " java.sql.SQLException: null,  message from server: "Host '192.168.2.15' is not allowed to connect to this MySQL server"

what might be the reason ?

Roy_sanu
0
Comment
Question by:roy_sanu
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38303774
The usual reason is that you have not set up a user that has privileges that allow it.  MySQL connections are based on username, password, and connection.  The connections can be 'localhost', a specific host like an IP address or domain name, or 'anyhost' which is literally any host but localhost.  http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

You should also click on "Request Attention" and get the MySQL zone added to your question.
0
 
LVL 28

Accepted Solution

by:
dpearson earned 1500 total points
ID: 38303775
That's a permission problem within the database.  You need to look at the account you're using to count to MySQL and what permissions (GRANTS) it has:

http://dev.mysql.com/doc/refman/5.0/en/show-grants.html

Generally a database is setup to only allow access from specific hosts (or IPs).  This makes it much more secure than allowing anyone to access it.  It sounds like you need to include either 192.168.2.15 or map 192.168.2.15 to a DNS name and give rights from that host.

Doug
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38303999
or 'anyhost' which is literally any host but localhost.

Are you talking about '%'? I didn't know that excluded localhost...
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:roy_sanu
ID: 38304309
Thank you so much,  working !!!!!!!!!!!!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38304376
That's a permission problem within the database.  You need to look at the account you're using to count to MySQL and what permissions (GRANTS) it has:

That's actually not the case. DaveBaldwin actually gave you a thumbnail sketch of how access control works. You'll get more detail at
http://dev.mysql.com/doc/refman/5.1/en/connection-access.html

Your connection failed because you failed access control. Grants are a different (and later) matter.
0
 

Author Comment

by:roy_sanu
ID: 38304405
again thanks to all
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38305619
@CEHJ, I've never specifically tested the difference between 'localhost' and 'anyhost' but all the examples I've seen including http://dev.mysql.com/doc/refman/5.1/en/adding-users.html and phpMyAdmin show them both as distinct users.  'localhost' is handled differently than 'anyhost'.  To quote http://en.wikipedia.org/wiki/Localhost :  
Using the loopback interface also bypasses local network interface hardware.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38305630
Thanks for that Dave - that's quite interesting
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question