java.sql.SQLException: Access denied for user 'user'@'192.168.1.2' (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:3421)
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(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at BasicDatbaseTest.main(BasicDatbaseTest.java:18)

I've tested everything locally, and the user can log in no problem and execute the exact same query.

February 29th, 2012, 11:29 PM

copeg

Re: Local Domain MySQL server, access denied

First, can you use JDBC to login as root (this will test whether your computer can actually see the database regardless of the user you created)? Second, I don't recommend inserting directly into the user table. Rather, use the predefined SQL to create and modify user permissions: MySQL :: MySQL 5.1 Reference Manual :: 12.7.1.1 CREATE USER Syntax