解决mysql.cj.exceptions.CJException: null, message from server: “Host ‘x‘ is not allowed to connect异常

datagrip连接时报错
报错
原因:权限问题
进入服务器进入mysql

update user set host = "%" where user="root"

操作截图
最后flush privileges更新操作即可