日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql grant查看用户权限命令

發布時間:2023/12/2 数据库 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql grant查看用户权限命令 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文章來給大家總結一些常用的來查看mysql用戶權限命令的一些方法總結,在mysql中查看用戶權限命令是show grants for了,下面我來詳細介紹grants這個命令,有需要了解的朋友可參考。


語句

?代碼如下復制代碼

show grants for 你的用戶

比如:

?代碼如下復制代碼

show grants for root@'localhost';

查看用戶權限。

?代碼如下復制代碼

show grants for 你的用戶;
show grants for root@'localhost';
show grants for webgametest@10.3.18.158;
show create database dbname;? 這個可以看到創建數據庫時用到的一些參數。
show create table tickets;??? 可以看到創建表時用到的一些參數


查看MYSQL數據庫中所有用戶

?

?代碼如下復制代碼
mysql>SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query???????????????????????????????? |
+---------------------------------------+
| User:;??????????????? |
| User: ;????????????? |
| User: ;????????????????????? |
| User: ;???????????????????? |
| User: ;??????????????????? |
| User: ;?????????????????? |
| User: ;???????????? |
| User: ;?????????? |
| User: ;?????? |
| User: ;? |
| User: ;?????? |
| User: ;???????????????? |
| User: ;??????????? |
| User: ;??????? |
| User: ;????????????? |
| User: ;????????? |
| User: ;???????? |
| User: ;???????????? |
| User: ;?????????? |
| User: ;???? |
| User: ; |
+---------------------------------------+
21 rows in set (0.01 sec)

?
?
查看數據庫中具體某個用戶的權限

?

?代碼如下復制代碼
mysql> show grants for ;???
+-------------------------------------------------------------------------------------------------------------------+
| Grants for???????????????????????????????????????????????????????????????????????????????????????????? |
+-------------------------------------------------------------------------------------------------------------------+
| GRANT PROCESS, SUPER ON *.* TO IDENTIFIED BY PASSWORD '*DAFF917B80E3314B1ABECBA9DF8785AFD342CE89' |
| GRANT ALL PRIVILEGES ON `cacti`.* TO?????????????????????????????????????????????????????????????? |
+-------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
?
mysql> select * from mysql.user where user='cactiuser' G?
*************************** 1. row ***************************
???????????????? Host: %
???????????????? User: cactiuser
???????????? Password: *DAFF917B80E3314B1ABECBA9DF8785AFD342CE89
????????? Select_priv: N
????????? Insert_priv: N
????????? Update_priv: N
????????? Delete_priv: N
????????? Create_priv: N
??????????? Drop_priv: N
????????? Reload_priv: N
??????? Shutdown_priv: N
???????? Process_priv: Y
??????????? File_priv: N
?????????? Grant_priv: N
????? References_priv: N
?????????? Index_priv: N
?????????? Alter_priv: N
???????? Show_db_priv: N
?????????? Super_priv: Y
Create_tmp_table_priv: N
???? Lock_tables_priv: N
???????? Execute_priv: N
????? Repl_slave_priv: N
???? Repl_client_priv: N
???? Create_view_priv: N
?????? Show_view_priv: N
? Create_routine_priv: N
?? Alter_routine_priv: N
???? Create_user_priv: N
?????????? Event_priv: N
???????? Trigger_priv: N
???????????? ssl_type:
?????????? ssl_cipher:
????????? x509_issuer:
???????? x509_subject:
??????? max_questions: 0
????????? max_updates: 0
????? max_connections: 0
?max_user_connections: 0

不但grants可以查看用戶權限,還可以授予MySQL用戶權限 創建、修改、刪除 MySQL 數據表結構權限哦

grant 創建、修改、刪除 MySQL 數據表結構權限。

?代碼如下復制代碼

grant create on testdb.* to developer@'192.168.0.%';
grant alter? on testdb.* to developer@'192.168.0.%';
grant drop?? on testdb.* to developer@'192.168.0.%';

grant 操作 MySQL 外鍵權限。

?代碼如下復制代碼

grant references on testdb.* to developer@'192.168.0.%';

grant 操作 MySQL 臨時表權限。

?代碼如下復制代碼

grant create temporary tables on testdb.* to developer@'192.168.0.%';

grant 操作 MySQL 索引權限。

grant index on? testdb.* to developer@'192.168.0.%';

grant 操作 MySQL 視圖、查看視圖源代碼權限。

?代碼如下復制代碼

grant create view on testdb.* to developer@'192.168.0.%';
grant show?? view on testdb.* to developer@'192.168.0.%';

grant 操作 MySQL 存儲過程、函數權限。

?代碼如下復制代碼

grant create routine on testdb.* to developer@'192.168.0.%';? -- now, can show procedure status
grant alter? routine on testdb.* to developer@'192.168.0.%';? -- now, you can drop a procedure
grant execute??????? on testdb.* to developer@'192.168.0.%';

總結

以上是生活随笔為你收集整理的mysql grant查看用户权限命令的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。