Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view all users and permissions in the MYSQL database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to view all the users and permissions in the MYSQL database. I hope you will get something after reading this article. Let's discuss it together.

View all users in the MYSQL database

Mysql > SELECT DISTINCT CONCAT ('User:'', user,'''@''',host,''';') AS query FROM mysql.user

+-+

| | query |

+-+

| | User: 'cactiuser'@'%'; |

| | User: 'common_user'@'%'; |

| | User: 'dba'@'%'; |

| | User: 'root'@'%'; |

| | User: 'slave'@'%'; |

| | User: 'wtgame'@'%'; |

| | User: 'root'@'127.0.0.1'; |

| | User: 'webman'@'127.0.0.1'; |

| | User: 'root'@'192.168.166.200'; |

| | User: 'cactiuser'@'192.168.166.202'; |

| | User: 'root'@'192.168.166.202'; |

| | User:''@ 'localhost'; |

| | User: 'cacti'@'localhost'; |

| | User: 'cactiuser'@'localhost'; |

| | User: 'dba'@'localhost'; |

| | User: 'extmail'@'localhost'; |

| | User: 'javauser'@'localhost'; |

| | User: 'root'@'localhost'; |

| | User: 'webman'@'localhost'; |

| | User:''@ 'localhost.localdomain'; |

| | User: 'root'@'localhost.localdomain'; |

+-+

21 rows in set (0.01 sec)

View the permissions of a specific user in the database

Mysql > show grants for 'cactiuser'@'%'

+-+

| | Grants for cactiuser@% |

+-+

| | GRANT PROCESS, SUPER ON *. * TO 'cactiuser'@'%' IDENTIFIED BY PASSWORD' * DAFF917B80E3314B1ABECBA9DF8785AFD342CE89' |

| | GRANT ALL PRIVILEGES ON `caction. * TO 'cactiuser'@'%' |

+-+

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

Viewing the user table structure requires specific items that can be queried in combination with the table structure

Mysql > desc mysql.user

+-+ +

| | Field | Type | Null | Key | Default | Extra | |

+-+ +

| | Host | char (60) | NO | PRI | |

| | User | char (16) | NO | PRI | |

| | Password | char (41) | NO | |

| | Select_priv | enum ('Nickel Magazine Y') | NO | | N | |

******************

******************

+-+ +

39 rows in set (0.00 sec)

After reading this article, I believe you have a certain understanding of "how to view all users and permissions in the MYSQL database". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report