I assume that your mysql connectivity library is not included in the project you are in. In order to rectify the error you are facing, try to use either the Maven Projects Solution or the All Projects Solution. In the former, add the mysql-connector dependency to the given project file pom.xml which is displayed below:-
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.39</version> </dependency>
The latter, add the jar library to the given project manually and follow the steps:-
Right Click the project -- > build path -- > configure build path
In the Libraries Tab press Add External Jar and Select your jar. As the file from the MYSQL connectivity library is not found, Java will give an exception while you build your project. In other words, to conclude is that once you add the library to the project, then Java will be able to locate the driver com.mysql.jdbc.Driver.
To know more about SQL, It's recommended to join Microsoft SQL Training today.