This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes I can't connect to my local MySQL machine! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "I can Watch "I can New topic
Author

I can't connect to my local MySQL machine!

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
This might seem to you like more of a mysql question than a java question... But I'm asking it anyway...

I'm getting this error in tomcat logs...


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


I'm on a WindowsXP SP2 machine... I've made exception for my sql port in my firewall... I've used SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd'); and UPDATE mysql.user SET Password = PASSWORD('newpwd') but still get this error... I don't understand... I'm just running from a local machine and I myself is not allowed to connect?


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

when you refer to your database, do you call it 'localhost' or by machine name? I'm guessing your jdbc url has the machine name.

the quick fix is to change this to 'localhost', the other option is to allow that user to connect from the 'remote' location, ie the external IP of you machine.

Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Instructions on how to allow 'remote' logins to MySQL cxan be found in this thread.
 
Consider Paul's rocket mass heater.
 
subject: I can't connect to my local MySQL machine!