装好mysql后,在python3程序中通过pymysql远程连接mysql,但是报 Host '*' not allowed connect错误

解决方法--该表:

首先用root登陆数据库:

[root@zabbix ~]# mysql -uroot -pxxxxx

mysql> use mysql;

mysql> update user set host = '%' where user = 'zabbix';

查看是否授权成功:

mysql> select host, user from user;
+-------------+--------+
| host | user |
+-------------+--------+
| % | zabbix |
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| zabbix | |
| zabbix | root |
+-------------+--------+
6 rows in set (0.00 sec)

加载刚才的设置:

mysql> FLUSH PRIVILEGES;

posted @ 2021-01-16 21:08  HackerEarl  阅读(115)  评论(0编辑  收藏  举报