I want to read the data from Mysql on terminal using JDBC driver in python pyspark. However, I keep getting the same issue of error Access denied for user 'root'@'localhost' error even after I've grant the privileges for the root@localhost.
My code:
spark.read.format("jdbc").option("url","jdbc:mysql://localhost:3306/users").option("dbtable","customers").option("user", "root").option("password","123@456").option("numPartitions",50).option("partitionColumn","ID").option("lowerBound", "1").option("upperBound", "100000").option("driver","com.mysql.jdbc.Driver").load().cache
I've grant privileges as suggested by many posted answers like:
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
What should I do to fix this issue?