Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ifteqar Ahmed
Ranch Hand
Posts: 85
Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 48954
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens when you log in to MySQL from the command line?
 
Ifteqar Ahmed
Ranch Hand
Posts: 85
Java Linux MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic