使用JDBC连接mysql时报message from server: "Host 'WHJZ-PC' is not allowed to connect to this MySQL server"错误,如图所示:
出现这种情况的原因是这个数据库的用户不允许从远程登录,只能使用localhost访问。解决办法是在安装mysql的服务器上更改“mysql”数据库里的“user”表中的“HOST”列的值更换为%:
关闭mysql服务,重新开启,再次访问即可成功
使用JDBC连接mysql时报message from server: "Host 'WHJZ-PC' is not allowed to connect to this MySQL server"错误,如图所示:
出现这种情况的原因是这个数据库的用户不允许从远程登录,只能使用localhost访问。解决办法是在安装mysql的服务器上更改“mysql”数据库里的“user”表中的“HOST”列的值更换为%:
关闭mysql服务,重新开启,再次访问即可成功