問題:
虛擬機192.168.211.101連接在192.168.211.2(宿主機)上的mysql報錯:
java.sql.SQLException: null, message from server: "Host '192.168.211.101' is not allowed to connect to this MySQL server"
解決方案:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.211.101' IDENTIFIED BY 'xxx' WITH GRANT OPTION;
效果:
在mysql.user表中添加了一條記錄
參考:遠程連接mysql時,提示“is not allowed to connect to this MySQL server”的解決方法