為mysql新增遠端登入許可權

2021-08-30 05:11:56 字數 895 閱讀 8595

1。改表法。可能是你的帳號不允許從遠端登陸,只能在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;

如果你想允許使用者myuser從ip為192.168.1.3的主機連線到mysql伺服器,並使用mypassword作為密碼

grant all privileges on *.* to

'myuser'@'192.168.1.3'

identified by 'mypassword' with grant option;

如果你想允許使用者myuser從ip為192.168.1.3的主機連線到mysql伺服器的abc資料庫,並使用mypassword作為密碼

grant all privileges on abc.* to 

'myuser'@'192.168.1.3'

identified by 'mypassword' with grant option;

然後再執行:

flush privileges;

MYSQL遠端登入許可權設定

mysql預設關閉遠端登入許可權,如下操作允許使用者在任意地點登入 1.進入mysql,grant all privileges on to root identified by with grant option identified by後跟的是密碼,可設為空。2.flush privilege...

MYSQL遠端登入許可權設定

現象 1 同一臺電腦在本機上有乙個視覺化軟體sql front,在虛擬機器上有乙個視覺化軟體sql front。資料庫伺服器開啟在虛擬機器上。在虛擬機器上使用sql front,可以正常連線mysql的資料庫,而在本機上無法連線。2 在虛擬機器上使用netstat ano findstr 3306 ...

mysql遠端登入許可權問題

遠端連線mysql資料庫的時候,報錯 出現 error 1130 hy000 host 192.168.14.1 is not allowed to connect to this mysql server提示資訊,不能遠端連線資料庫。解決方案如下 這個時候只要在localhost的那台電腦,登入m...