关于对连接数据库时出现1130-host “**” is not allowed to connect to this MySql/mariadb server 的错误解决方法

在完成mariadb的搭建后,在端口与防火墙均为正常的情况下,出现了1130- Host xxx is not allowed to connect to this MariaDb server 的情况。

笔者在网络上寻找了许久,最终发现了是因为授权的问题,使得连接权限受阻。

所以,我们在这里,只需要进入数据库中,给予其权限即可。具体解决代码如下:

[root@localhost ~]# mysql -u root -p
Enter password:

#首先进入mysql数据库中

MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.15 sec)

#进入之后,输入以上代码,目的是将登录的主机设置为全部都能登录

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.13 sec)

#随后,直接更新服务。或者直接重启mariadb server服务

MariaDB [(none)]> exit;
Bye

#退出数据库,结束!

现在再使用navicat连接使用即可。

 

posted @ 2018-06-20 20:11  沐子明  阅读(4462)  评论(0编辑  收藏  举报