MYSQL遠端登入許可權設定

2021-09-01 17:57:23 字數 1967 閱讀 7715

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

mysql預設關閉遠端登入許可權,如下操作允許使用者在任意地點登入:

1. 進入mysql,grant all privileges on *.* to 'root'@'%' identified by '' with grant option;

identified by後跟的是密碼,可設為空。

2. flush privileges; 更新

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

五、mysql許可權詳細分類:

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