mysql實現遠端連線

2021-09-01 13:45:57 字數 687 閱讀 3970

可能是你的帳號不允許從遠端登陸,只能在localhost。這個時候只要在localhost的那台電腦,登入mysql後,更改 "mysql" 資料庫裡的 "user" 表裡的 "host" 項,從"localhost"改稱"%"

mysql -u root -pvmwaremysql>use mysql;

mysql>update user set host = '%' where user = 'root';

mysql>select host, user from user;

2. 授權法。

例如,你想myuser使用mypassword從任何主機連線到mysql伺服器

的話。grant all privileges on *.* to 'myuser'@'%' identified by 'mypassword' with grant option;

flush   privileges;

如果你想允許使用者myuser從ip為192.168.1.6的主機連線到mysql伺服器

,並使用mypassword作為密碼

grant all privileges on *.* to 'myuser'@'192.168.1.3' identified by 'mypassword' with grant option;

flush   privileges;

mysql連線實現 MySql實現遠端連線

1 進入mysql,建立乙個新使用者root,密碼為root 格式 grant 許可權 on 資料庫名.表名 to 使用者 登入主機 identified by 使用者密碼 grant select,update,insert,delete on to root 192.168.1.12 ident...

實現MySQL遠端連線

1 直接修改mysql資料庫的user表記錄 1mysql u root p password 2use mysql 3update user sethost where user root 將host欄位的值改為 就表示在任何客戶端機器上能以root使用者登入到mysql伺服器,建議在開發時設為 ...

mysql實現遠端連線

grant all privileges on to root identified by youpassword with grant option flush privileges mysql預設情況下,只允許localhost連線,如果需要外部ip連線到mysql,需要向mysql資料庫裡的 ...