spark程序远程连接mysql数据库报错

Exception in thread "main" java.sql.SQLException: null,  message from server: "Host '192.168.1.121' is not allowed to connect to this MySQL server"


报错原因:mysql服务器不允许远程连接

经查找资料,解决方式如下:

登录mysql数据库:

mysql -uroot -p


执行

use mysql;

show tables;



查看:select host from user;


修改:update user set host = '%' where user = 'root';



然后重启mysql服务,重新提交spark程序成功将数据写入mysql

全部评论

相关推荐

投递长鑫存储等公司8个岗位
点赞 评论 收藏
分享
点赞 评论 收藏
分享
求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务