mysql 使用者訪問許可權問題

2021-07-13 22:45:53 字數 1014 閱讀 6386

mysql 對使用者連線訪問請求會對ip做最小匹配處理,如:

1、新建兩個使用者並賦予不同的訪問許可權

mysql> grant selecton*

.*to tuser@'10.%' identified by

'tuser';

query ok, 0

rows affected (0.00 sec)

mysql> grant usage on*.

*to'tuser'@'10.1.%';

query ok, 0

rows affected (0.00 sec)

2、在10網段對db進行連線請求

[root@test1 ~]# mysql -h10.1.1.1 -utuser -p

enter password:

error 1045 (28000): access denied for user 'tuser'@'10.1.1.1' (using password: yes)

[root@test1 ~]# mysql -h10.1.1.1 -utuser

welcome to the mysql monitor. commands end with ; or \g.

...mysql> show grants;

+----------------------------------------+

| grants for [email protected].% |

+----------------------------------------+

| grant usage on *.* to 'tuser'@'10.1.%' |

+----------------------------------------+

1 row in set (0.00 sec)

從結果明顯看到,連線的使用者是較小ip段的。將10.% 網段的tuser設為空密碼,出來的結果也是一樣。

mysql 新增使用者訪問許可權

感謝作者 王富貴 grant 許可權 on 資料庫物件 to 使用者 password mysql grant all on to root identified by abc123 query ok,0 rows affected 0.01 sec mysql select host,user,p...

MySQL使用者管理和訪問許可權

create user username 主機 identified by password username localhost 使用者只能從本地主機進行連線 username 192.168.199.101 使用者可以從主機192.168.199.101進行連線 username 192.168...

mysql加訪問許可權 mysql 新增使用者訪問許可權

grant 許可權 on 資料庫物件 to 使用者 passwordmysql grant all on to root identified by abc123 query ok,0 rows affected 0.01 sec mysql select host,user,password fr...