本地django远程链接服务器的mysql,报(1130, "Host '*.*.*.*' is not allowed to connect to this MySQL server")
一、问题描述
使用授权语句显示语法错误。
二、解决方案
1.在安装Mysql数据库的主机上登录root用户:
mysql -u root -p
2.依次执行如下命令:
use mysql;
select host from user where user='root';
可以看到当前主机配置信息为localhost。
3.执行update user set host = '%' where user ='root';
将Host设置为通配符%。
4.权限刷新。
flush privileges;
大功告成,重新执行python manage.py runserver