mysql遠端訪問

2021-06-22 08:18:36 字數 1018 閱讀 6801

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

mysql -u root -pvmwaremysql>use mysql;

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

mysql>flush privileges;

mysql>select host, user from user;

2、授權法。例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。

grant all privileges on *.* to 

'myuser'@'%'identified

by 'mypassword' wi

th grant option;

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

grant all privileges on *.* to 

'myuser'@'192.168.1.3'identified

by'mypassword' with grant option;

另外一種方法:

在安裝mysql的機器上執行:

1、d:\mysql\bin\>mysql -h localhost -u root

//這樣應該可以進入mysql伺服器

2、mysql>grant all privileges on *.* to 

'root'@'%'with

grant option

//賦予任何主機訪問資料的許可權

3、mysql>flush privileges

//修改生效

4、mysql>exit

//退出mysql伺服器

這樣就可以在其它任何的主機上以root身份登入啦。

遠端訪問mysql 程式 遠端訪問MySQL

1.確保server端允許被遠端訪問及防火牆放行。確保server端mysql庫中user表中包含host為client端ip資料條目,另外需要知道user和password內容,若沒有可人為新增 按照常理只要host項中包含 就代表允許任何client訪問,但是我的卻沒有成功,只好新增特定ip 在...

mysql 開啟遠端訪問 遠端訪問

select host,user,password from user 查詢使用者遠端訪問相關資訊 用root使用者登陸,然後 grant all privileges on to 建立的使用者名稱 identified by 密碼 flush privileges 重新整理剛才的內容 格式 gra...

mysql 遠端訪問

報類似這樣的 error 1130 host 192.168.1.3 is not allowed to connect to this mysql server 解決辦法 user表裡host列,表明的是使用者可登陸的計算機名,所以辦法有 1,改表 在localhost的那台電腦,登入mysql後...