默認用戶是經過localhost訪問的。mysql
登錄mysql後,切換到mysql數據庫,修改user表中指定用戶的host字段內容。sql
USE mysql; SELECT USER, HOST FROM USER WHERE USER ='root'; UPDATE USER SET HOST = '%' WHERE USER ='root'; FLUSH PRIVILEGES;
或者數據庫
Grant all privileges on *.* to 'root'@'%' identified by '你的密碼' with grant option; flush privileges;