I have a strange problem connecting to publicly hosted static IP mysql server.
I am able to connect to the server successfully with MySQL Workbench and also on the local remote server through SSH. However the connection attempt to the mysql server from jdbc connecter(both through NetBeans and through the locally deployed code fails). On looking into the logs, the code is trying to connect with remote server considering the user credentials are of a local user instead of remote user. So the user exists on remote but java considers user@localhost while trying connection. The exact error appears as:
Caused by: java.sql.SQLException: Access denied for user 'user'@'c-24-130-52-20.hsd1.ca.comcast.net' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) ~[mysql-connector-java-5.1.27.jar:na] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) ~[mysql-connector-java-5.1.27.jar:na] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) ~[mysql-connector-java-5.1.27.jar:na] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:928) ~[mysql-connector-java-5.1.27.jar:na] at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1750) ~[mysql-connector-java-5.1.27.jar:na]
My connection string is :
jdbc:mysql://user:password@W.X.Y.Z/
Can someone please suggest how to mention the user so java considers it to be a remote user instead of local user on my machine?