CentOS7中Host is not allowed to connect to this MySQL server解决方法

安装好mysql并打开端口后,远程连接mysql,报错Host is not allowed to connect to this MySQL server

是因为centOS中的MySQL不允许远程连接

解决办法:

1、登录MySQL mysql -u root -p密码
2、执行 use mysql

CentOS7中Host is not allowed to connect to this MySQL server解决方法_第1张图片

3、执行update user set host =’%’ where user = ‘root’;执行会报错,不影响结果

CentOS7中Host is not allowed to connect to this MySQL server解决方法_第2张图片
CentOS7中Host is not allowed to connect to this MySQL server解决方法_第3张图片

4 、执行flush privileges;

在这里插入图片描述

5、更改成功

CentOS7中Host is not allowed to connect to this MySQL server解决方法_第4张图片

你可能感兴趣的:(linux,报错,CentOS7中Host,is,not,allowed,to,connect,to,this,MySQL,server解决方法)