遠端連線mysql解決方案

2021-10-09 15:56:31 字數 1370 閱讀 9838

報錯:1130-host … is not allowed to connect to this mysql server

解決方法:

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;

授權法。

例如,你想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;

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

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

flush privileges;

我用的第乙個方法,剛開始發現不行,在網上查了一下,少執行乙個語句 mysql>flush rivileges 使修改生效.就可以了

另外一種方法,不過我沒有親自試過的,在csdn.net上找的,可以看一下.

在安裝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 u root p 執行登入 grant all on to root identified by 密碼 etc mysql mysql.conf.d mysqld.cnf注意 其他 linux系統 可能在 etc mysql my.cnf 注釋 bind address 127.0.0....

mysql 遠端連線速度慢的解決方案

mysqld skip name resolve skip name resolve 選項就能禁用dns解析,連線速度會快很多。不過,這樣的話就不能在mysql的授權表中使用主機名了而只能用ip格式。若使用 skip grant tables系統將對任何使用者的訪問不做任何訪問控制,但可以用 mys...

mysql 解決方案 Mysql解決方案

mysql解決方案 一 centos7安裝mysql5.7 wget rpm uvh mysql80 community release el7 3.noarch.rpm yum repolist all grep mysql 發現預設mysql8.0是預設安裝的,然而我們要安裝的是mysql5.7...