aspose file tools*
The moose likes Object Relational Mapping and the fly likes Unable to connect to MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Unable to connect to MySQL" Watch "Unable to connect to MySQL" New topic
Author

Unable to connect to MySQL

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Not sure if this is the correct forum, but I couldn't find a better one.

I have MySQL up and running. I created a new user, and attempted to connect using Hibernate. However, I keep getting Access Denied errors. I can't connect using the MySQL GUI Tools either with that user.

I'm not sure what I'm doing wrong. TIA.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Sounds like that user doesn't have access rights. Check the password and privilages for the user.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
How do I do that? I haven't set up MySQL before.

I just redid the password, and it still won't let me log on. So it must be some sort of permission issue.
[ November 17, 2008: Message edited by: Bai Shen ]
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Fixed it. Turns out I had to specify a host for it to connect from.
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I've run into the same problem with another MySQL database. I'm trying to connect the GUI Tools from another machine, and it won't let me. I did some googling and tried running the following logged in as root.

GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY 'pass" WITH GRANT OPTION;

AFAIK, that will allow me to connect to the db from anywhere. However, I keep getting back the same error.

ERROR 1045: Access denied for user: '@127.0.0.1' (Using password: NO)

Any help would be appreciated.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

(Using password: NO)


This phrase indicates that the client did not provide a password when attempting to connect. Make sure you supply a password when attempting to connect.


JBoss In Action
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Is it because I don't have a password set for my root user?

The error I got wasn't using the gui tools. That was running directly from the mysql window.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to connect to MySQL