you need to find a compatible version for your MySQL installed version
Default one is
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
Change it to some version
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
Now remove the default dependency installed. "package explorer"> your project > "Maven dependencies">type MySql it will come, now delete it(mysql-connector-java-x.y.z.jar)
Try to give a version nearer to your MySql version & check maven repository and
find a nearer version having more usage
For me, MySql version is 5.0.27 which you can see from "MySQL command-line client" and the version I tried is 5.1.46
1 more thing is to add to the application.proerties
spring.datasource.driver-class-name= com.mysql.jdbc.Driver
But, if you are taking MySql dependency version nearer to 8 it is
spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver
which is not required as it takes internally
Now do "clean install" your app, right-click "run as">mvn clean & "run as">mvn install, then build your application using right-click "maven">update project(Alt+F5)
Now to confirm version change, check maven dependency, mysql-connector-java-5.1.46.jar (whichever is your mentioned dependency)
And, if still not working make sure you have checked with some applications having localhost server. Then check /etc/drivers/hosts file & uncomment this line
# 127.0.0.1 localhost