mysql开启网络 java.sql.SQLException: null, messag...

java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server":java

表示该对象不是远程对象,不能经过该对象远程访问数据mysql

解决:sql

方案一:改表:服务器

use mysql ;select user,host,password from user;this

update user set host = '%' where user='root';spa

方案二:受权法:server

例如,你想myuser使用mypassword从任何主机链接到mysql服务器的话。 
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 
若是你想容许用户myuser从ip为192.168.1.3的主机链接到mysql服务器,并使用mypassword做为密码 
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;对象

相关文章
相关标签/搜索