远程访问mysql设置

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

java.sql.SQLException: Access denied for user 'root'@'xxx.xxx.xxx.xxx' at (数据库名)mysql

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

解决:数据库

方案一:改表:服务器

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

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

方案二:受权法:.net

例如,你想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;server

不管使用哪一种方案,请重启Mysql服务。对象

相关文章
相关标签/搜索