title: Cant connect to Mysql database from pyspark, getting jdbc error
body: <p>I am learning pyspark, and trying to connect to a mysql database.</p>
  
  <p>But i am getting a <code>java.lang.ClassNotFoundException: com.mysql.jdbc.Driver</code> Exception while running the code. I have spent a whole day trying to fix it, any help would be appreciated :)</p>
  
  <p>I am using pycharm community edition with anaconda and python 3.6.3</p>
  
  <p>Here is my code:</p>
  
  <pre><code>from pyspark import SparkContext,SQLContext
  sc= SparkContext()
  sqlContext= SQLContext(sc)
  
  df = sqlContext.read.format("jdbc").options(
  url ="jdbc:mysql://192.168.0.11:3306/my_db_name",
  driver = "com.mysql.jdbc.Driver",
  dbtable = "billing",
  user="root",
  password="root").load()
  </code></pre>
  
  <p>Here is the error: </p>
  
  <pre><code>py4j.protocol.Py4JJavaError: An error occurred while calling o27.load.
  : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
  </code></pre>