Getting error while connecting to MySQL database by using pyspark



I am trying to connect to MySQL database in pyspark. But, I am getting “No Suitable Driver” error message. For your reference, I am attaching the screenshot of the code (Green Color) and error message (Yellow Color).

Thanks in advance.


Can someone help with SQL exception while trying accessing MYSql DB from PYSPARK.


Launch pyspark with below command:

pyspark --jars /usr/share/java/mysql-connector-java.jar --master yarn --conf spark.ui.port=12643

and run the below code

mysql =“jdbc”).
option(“url”, “jdbc:mysql://”).
option(“driver”, “com.mysql.jdbc.Driver”).
option(“dbtable”, “orders”).
option(“password”, “itversity”).