mysql映射外網訪問不了的解決方法:
1,修改表,登錄mysql數據庫,切換到mysql數據庫,使用sql語句查看"select host,user from user ;"在命令行輸入如下:
mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
mysql>flush privileges;
2.授權用戶。命令如:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION;flush privileges;
例如:允許用戶root從ip為192.168.1.104的主機連接到mysql服務器的代碼:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.104' IDENTIFIED BY 'admin123' WITH GRANT OPTION;flush privileges;