This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: I can't connect to my local MySQL machine!
 
Similar Threads
"main" java.sql.SQLException: Access denied for user 'root'@'192.168.1.1' (using password: YES)
tomcat mysql connection issues
J2EE/J2SE JDBC
Java MySQL connection
MySql Connection