MySQL 1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server

Posted Eco

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL 1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server相关的知识,希望对你有一定的参考价值。

在开发中为了让开发更方便,在本地配置环境,希望可以直接访问服务器上的mysql数据库,更方便的管理数据库,

需要在本地远程连接linux服务器的本地数据库,直接用数据库管理工具连接出现如下报错1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server:

这个错误说明MySQL没有允许远程登录,只要授权可以远程登录就ok了。

 

登录到服务器上,mysql -u root -p 回车,password:(输入你的密码),进入到mysql之后输入命令:

GRANT ALL PRIVILEGES ON *.* TO root@% IDENTIFIED BY yourpassword WITH GRANT OPTION;  /*把命令中的‘yourpassword’换成你的数据库密码*/

 

修改以后再键入刷新使用权限命令:

FLUSH PRIVILEGES

 

这里不输入刷新权限命令的话也可以重启mysqld,命令:

service mysqld restart

完成后使用数据库管理工具连接服务器一切正常!

以上是关于MySQL 1130 - Host 127.0.0.1 is not allowed to connect to this MySQL server的主要内容,如果未能解决你的问题,请参考以下文章

Mysql连接报错:1130-host ... is not allowed to connect to this MySql server如何处理

解决ERROR 1130: Host '*.*.*.*' is not allowed to connect to this MySQL server 方法

Linux环境 mysql用navicat远程连接常见问题2003 1130 1045

mysql不能使用IP连接,可以使用localhost连接

Host 127.0.0.1 is not allowed to connect MySQL

Host '127.0.0.1' is not allowed to connect to this MySQL server