0

I want to connect mysql db from my springboot project. My username and password is defined in "application.properties" file. I can use this username and password for connect mysql from terminal but the other side intellij cant connect with this informations. What should i do about this

I have changed the root password with a new password

This is my application.properties file

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/(nameofdb)
spring.datasource.username=(root)
spring.datasource.password=(password)
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
  • have you followed exact steps like in this: https://spring.io/guides/gs/accessing-data-mysql/ – bananas Aug 27 '19 at 11:53
  • Possible duplicate of [MySQL Error: : 'Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost) – Andrey Aug 27 '19 at 13:02

2 Answers2

0

Usually, this error is a reference for the wrong user or password in your database. It is not a problem from your Spring application.

I have checked on StackOverflow and check this link to help you with this problem. MySQL Permission

nilsonjr
  • 66
  • 1
  • 8
-1

Maybe you have to define the driver class : add this line and try

spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
Hadi GhahremanNezhad
  • 2,377
  • 5
  • 29
  • 58