Access denied for user developer@localhost (using password: YES) while connecting spring boot application to mysql server installed in EC2 instance

Viewed 40

I created an EC2 instance and installed mySQL in it.

Then, I ran the following commands...

create user 'developer'@'%' identified by 'password';
grant all privileges on *.* to 'developer'@'%' with grant option;
flush privileges;

Then, I created a connection to the remote mySQL server from MySQL workbench installed on my local system. Connection was successful.

Then, to connect my spring boot application to the remote mySQL server I changed the configuration in the 'application.properties' file as shown below -

spring.datasource.url=jdbc:mysql://localhost:3306/exam?serverTimezone=UTC
spring.datasource.username=developer
spring.datasource.password=password

But then when I tried to run the application, it showed the following -

Access denied for user 'developer'@'localhost' (using password: YES)

I searched for a solution on stackoverflow and one of the answers said '%' does not include 'localhost' and that a separate user should be created for localhost.

Hence, I created another user 'developer'@'localhost' with same privileges but still the issue remains unsolved.

0 Answers
Related