mysql遠端授權使用者或主機 mysql

2021-08-31 16:28:13 字數 1311 閱讀 3475

//授權操作

grant all on *

.* to 'root'@'%' identified by '123456'

with grant option;

//允許賬戶root從任何主機連線到所有資料庫(*.*)

grant all on test.

* to 'user'@'%' identified by '123456'

with grant option;

//允許賬戶user從任何主機連線到test資料庫(test.*)

釋放遠端授權:

revoke all on *.*

from

'user'@'%'

;//禁止使用者user從任何主機訪問所有資料庫

revoke all on test.

*from

'user'@'%'

;//禁止使用者user從任何主機訪問test資料庫

flush privileges;

//重新整理系統授權表

mysql> use mysql;

database changed

mysql> select host,user from user;+--

----

-----+

------+

----

----

----

----

----

----

----

----

----

-------

+| host | user | password |+--

----

-----+

------+

----

----

----

----

----

----

----

----

----

-------

+| localhost | root |

*81f5e21e35407d884a6cd4a731aebfb6af209e1b |+--

----

-----+

------+

----

----

----

----

----

----

----

----

----

-------

+

MySql授權使用者遠端訪問

建立了乙個mmroot的使用者,密碼為mm1234 表示資料和表 表示所有的ip都可以訪問 即可以遠端訪問 all privileges表示所有的許可權 with grant option表示授權使用者的許可權 例項 mysql grant all privileges on to mmroot i...

遠端使用者連線mysql授權

mysql 授權法 在安裝mysql的機器上執行 1 d mysql bin mysql h localhost u root 這樣應該可以進入mysql伺服器 2 mysql grant all privileges on to root with grant option 賦予任何主機訪問資料的...

遠端使用者連線mysql授權

在安裝mysql的機器上執行 1 mysql u myuser p xx 進入mysql伺服器 2 mysql grant all privileges on to root with grant option 賦予任何主機訪問資料的許可權 例如,你想myuser使用mypassword從任何主機連...