1) Download connector from here https://www.mysql.com/products/connector/
2) Select JDBC driver for mysql
3) click on Platform Independent (Architecture Independent), ZIP Archive
4) Download the file and unzip it
5) (For Eclipse)Click Project->properties-> Java Build Path->Libraries
(For Netbeans) right click libraries on left bar-> add jar
6) Click on add external jar
7) select mysql-connector-java-5.1.40-bin.jar
8) Done!