There is a similar question . Start pyspark as follows
./bin/pyspark
Then just run
sqlContext.read.format("jdbc").options( url ="jdbc:mysql://localhost/mysql", driver="com.mysql.jdbc.Driver", dbtable="user", user="root", password="" ).load().take(10)
It most likely will just work. But it depends on your mysql setting, so if it does not try to change the password, username, db-url and other parameters.
source share