File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes 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 ""main" java.sql.SQLException: Access denied for user Watch ""main" java.sql.SQLException: Access denied for user New topic
Author

"main" java.sql.SQLException: Access denied for user 'root'@'192.168.1.1' (using password: YES)

Ifteqar Ahmed
Ranch Hand

Joined: May 02, 2011
Posts: 85

Hi Friends,

Can You Tell me why i am getting this exception and what can i do to resolve this?

Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'192.168.1.1' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:885)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3436)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1247)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2775)
at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at imagesstore.Main.main(Main.java:13
)


my code is




Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38048
    
  22
What happens when you log in to MySQL from the command line?
Ifteqar Ahmed
Ranch Hand

Joined: May 02, 2011
Posts: 85

Hi,

Mysql server is located in Linux and i am writing my application in windows. but i do not know how to connect to mysql of linux machine from my local machine. Please help...

I tried to connect to mysql using HeidSQL but its throwing the same error.
Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

http://www.java2s.com/Tutorial/MySQL/0540__Privilege/0100__Remote-User.htm

http://www.howtogeek.com/howto/programming/mysql-give-root-user-logon-permission-from-any-host/

It seems like you did not give your root user remote access. Either of the above links should provide you with enough information to enable it.


OCJP6, OCWCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "main" java.sql.SQLException: Access denied for user 'root'@'192.168.1.1' (using password: YES)
 
Similar Threads
MySQL error
JSP: Unable to connect to mysql in local drive [Solved]
Mysql/JDBC Access Denied Error
mysql query
Exception while connecting to database