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;對象

相關文章
相關標籤/搜索