spark连接mysql数据库
                        
                            时间:2021-07-01 10:21:17
                            帮助过:28人阅读
							                        
                     
                    
                    
                     
- 安装启动检查Mysql服务。
 netstat -tunlp (3306)
- spark 连接mysql驱动程序。
 –cp /usr/local/hive/lib/mysql-connector-java-5.1.40-bin.jar /usr/local/spark/jars
  -   -   
- 启动 Mysql shell,新建数据库spark,表student。
 select * from student;
  -   -   
- spark读取MySQL数据库中的数据
 spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/spark?useSSL=false") ...  .load()
  -   -   
- spark向MySQL数据库写入数据
 studentDF.write.format(‘jdbc’).option(…).mode(‘append’).save()
 
spark连接mysql数据库
标签:sql数据库   mat   bsp   mysql   localhost   hive   zoom   mic   info