First of all, we are able to access the RDS/MySQL database using the following command:
mysql -h ckinstance.cx2ecc4osrgp.us-west-2.rds.amazonaws.com -P 3306 -u ck -p<PASSWORD>
We then tried adding in the root user and password to provide access to the RDS/MySQL database via:
create user 'ck'@'ckinstance.cx2ecc4osrgp.us-west-2.rds.amazonaws.com' identified by '<PASSWORD>';
grant all privileges ck.* to 'ck'@'ckinstance.cx2ecc4osrgp.us-west-2.rds.amazonaws.com';
Our webapp properties file has:
com.careerkick.jpa.url=jdbc:mysql://ckinstance.cx2ecc4osrgp.us-west-2.rds.amazonaws.com:3306/ck
com.careerkick.jpa.username=ck
com.careerkick.jpa.password=<password>
However, when we run our webapp, the logs show that it's still trying to access it via the localhost:
com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0
com.mchange.v2.resourcepool.BasicResourcePool -
com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6c3bae8 -- Acquisition
Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new
resource, we failed to succeed more than the maximum number of allowed acquisition
attempts (30). Last acquisition attempt exception:
java.sql.SQLException: Access denied for user 'ck'@'172.31.29.230' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1709)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1252)
For some reason, it seems to want to use the localhost IP.
I also tried creating the user via using a localhost IP as well.
create user 'ck'@'172.31.29.230' identified by '';
But that didn't work either.
I also used this article as a reference:
java.sql.SQLException: Access denied for user
Are there any other suggestions or is there something else I might be missing in regards to this database connection issue? Thanks.