Close NetBeans.
Stop MySQL Server.
Update MySQL (if available)
Start MySQL Server.
Open NetBeans.
If still doesn't connect, download MySQL Connector/J and add mysql-connector-java-[version].jar to your
classpath and also to your Webserver's lib directory. For instance, Tomcat lib path
in XAMPP is
C:\xampp\tomcat\lib.
Then repeat the steps again.