原因:
这里的 xxx.xxx.xxx.xxx 是你自己电脑的IP地址,出现这个错误的原因是你的服务器中的数据库之允许本地访问,即从数据库访问,外部连接是访问不到的。
解决方法:
修改MySQL数据库中的 user表格,将host的“localhost”修改为“%”,然后重启MySQL服务。
可以通过代码修改
update user set host='%' where user='root';
也可以使用可视化工具进行修改
这里的 xxx.xxx.xxx.xxx 是你自己电脑的IP地址,出现这个错误的原因是你的服务器中的数据库之允许本地访问,即从数据库访问,外部连接是访问不到的。
修改MySQL数据库中的 user表格,将host的“localhost”修改为“%”,然后重启MySQL服务。
可以通过代码修改
update user set host='%' where user='root';
也可以使用可视化工具进行修改