Centos——连接服务器数据库报错:SQL执行错误#1130 Host ‘xxxxx’ is not allowed to connect to this....
错误原因分析及措施
这是因为所连接的用户没有远程连接的权限,该数据库只能在本机(localhost)登录。我们只需更改服务器mysql 数据库里的 user表中 host项,把localhost改称%。
mysql -u root -p; 进入数据库
Enter password:xxxx
use mysql; //进入mysql库
update user set host=@'%' where user='root' and host='localhost' limit 1;
//更新服务器为用户可登录的情况
并使用命令:flush privileges;
使得更新完成
最后就可以成功连接了。