首先查看防火墙是否关闭
service iptables status
确认关闭后,首先登陆mysql
mysql -hhadoop【指定连接地址】 -uroot -p123456
打开user表查看user表中的数据
use mysql;
select user,host from user;
更改连接的权限(确保可以远程连接)
方式一:grant all privileges on . to ‘root’ @ ‘%’ identified by ‘123456’;【点是被*引起来的,博客会自己忽略掉】
方式二:grant all privileges on . to root@"%" identified by “password” with grant option;
flush privileges;
再次查看user表
select user,host from user;
确认无误后,再次重新连接,问题就解决了