centos 配置mysql允許遠端登入

2021-10-03 03:39:16 字數 1535 閱讀 6063

mysql為了安全性,在預設情況下使用者只允許在本地登入,可是在有此情況下,還是需要使用使用者進行遠端連線,因此為了使其可以遠端需要進行如下操作:

一、允許root使用者在任何地方進行遠端登入,並具有所有庫任何操作許可權,具體操作如下:

在本機先使用root使用者登入mysql:

mysql -u root -p"youpassword" 

進行授權操作:

mysql>grant all privileges on . to 『root』@』%』 identified by 『youpassword』 with grant option;

過載授權表:

flush privileges;

退出mysql資料庫:

exit

二、允許root使用者在乙個特定的ip進行遠端登入,並具有所有庫任何操作許可權,具體操作如下:

在本機先使用root使用者登入mysql:

mysql -u root -p"youpassword" 

進行授權操作:

grant all privileges on . to root@「172.16.16.152」 identified by 「youpassword」 with grant option;

過載授權表:

flush privileges;

退出mysql資料庫:

exit

三、允許root使用者在乙個特定的ip進行遠端登入,並具有所有庫特定操作許可權,具體操作如下:

在本機先使用root使用者登入mysql:

mysql -u root -p"youpassword" 

進行授權操作:

grant select,insert,update,delete on . to root@「172.16.16.152」 identified by 「youpassword」;

過載授權表:

flush privileges;

退出mysql資料庫:

exit

四、刪除使用者授權,需要使用revoke命令,具體命令格式為:

revoke privileges on 資料庫[.表名] from user-name;

具體例項,先在本機登入mysql:

mysql -u root -p"youpassword" 

進行授權操作:

grant select,insert,update,delete on test-db to test-user@「172.16.16.152」 identified by 「youpassword」;

再進行刪除授權操作:

revoke all on test-db from test-user;

****注:該操作只是清除了使用者對於test-db的相關授權許可權,但是這個「test-user」這個使用者還是存在。

最後從使用者表內清除使用者:

delete from user where user=「test-user」;

過載授權表:

flush privileges;

退出mysql資料庫:

exit

CentOS 配置MySQL允許遠端登入

mysql為了安全性,在預設情況下使用者只允許在本地登入,可是在有此情況下,還是需要使用使用者進行遠端連線,因此為了使其可以遠端需要進行如下操作 一 允許root使用者在任何地方進行遠端登入,並具有所有庫任何操作許可權,具體操作如下 在本機先使用root使用者登入mysql mysql u root...

CentOS 配置mysql允許遠端登入

安裝了mysql預設是拒絕遠端連線的。首先進入資料庫,使用系統資料庫mysql。1 mysql u root p mysql 回車,然後輸入則使用了系統資料庫接著對系統資料庫的root賬戶設定遠端訪問的密碼,與本地的root訪問密碼並不衝突。1 grant all privileges on to ...

mysql 允許遠端登入配置

兩步 一 更改 mysql 資料庫裡的 user 表裡的 host 項 經此步便可在遠端登入 x mysql u root pvmware mysql use mysql mysql update user set host where user root mysql select host,use...