主機不能遠程連接mysql數據庫的解決辦法
阿新 • • 發佈:2018-09-21
pass 數據庫 upd grant update star 遠程連接mysql 連接 use 1。改表法。在數據庫所在機器登入mysql後,更改 "mysql" 數據庫裏的 "user" 表裏的 "host" 項,把"localhost"改稱"%"
mysql -u root -p mysql>use mysql; mysql>select ‘host‘ from user where user=‘root‘; mysql>update user set host = ‘%‘ where user =‘root‘; mysql>flush privileges; mysql>select host,user from user where user=‘root‘;
重起mysql服務即可完成。
- 授權法。在數據庫所在機器登入mysql後,直接進行授權
grant all privileges on . to ‘root‘@‘%‘ identified by ‘password‘ with grant option;
主機不能遠程連接mysql數據庫的解決辦法