mysql8.0开启远程访问权限
问题描述:
JAVA环境中Idea连接数据库报错,信息如下所示
The specified database user/password combination is rejected: com.mysql.cj.exceptions.CJException: Access denied for user ‘root’@‘xxx.xxx.xx (using password: YES)
先登录Mysql (mysql -uroot -p密码)
1.首先查看user
表
select user,authentication_string,host from user;
如下图则是没开启远程访问权限
2.设置远程访问权限为root
update user set host = '%' where user = 'root';
3.刷新数据库完成修改
FLUSH PRIVILEGES;