If you are working with Maven, add these to your pom.xml:
For MySQL 5.6, 5.7, 8.x and Java >= 8 use the following;
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
For MySQL <= 5.5 or Java <= 7 or JDBC < 4.2 use the following;
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.48</version>
</dependency>
Want to know more about SQL ? Join this SQL Certification by Intellipaat now.