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

Two methods of how to query user's right in MySQL

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

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor shares with you two methods of how to query user permissions in MySQL. I believe many people don't know much about it. In order to make you understand better, I summed up the following contents and looked down together. I'm sure you'll get something.

Introduce two ways to view MySQL user rights

1. Use the MySQL grants command

Mysql > show grants for username@localhost +-+ | Grants for root@localhost | +-- -+ | GRANT ALL PRIVILEGES ON *. * TO 'root'@'localhost' WITH GRANT OPTION | +-- -+

It is important to note that:

The combination of ● username and ip needs to exist in the mysql.user table, which can be seen through the select * from mysql.user command

● ip address should be in quotation marks if it is in wildcard format, for example: show grants for root@'172.%'

2. Use the MySQL select command

Mysql > select * from mysql.user where user='root' and host='localhost'\ G * * 1. Row * Host: localhost User: root Password: * * Select_priv: Y Insert_priv: Y Update_priv: Y Delete_priv: Y Create_priv: Y Drop_priv: Y Reload_priv: Y Shutdown_priv: Y Process_priv: Y File_priv: Y Grant_priv: Y References_priv: Y Index_priv: Y Alter_priv: Y Show_db_priv: Y Super_priv: Y Create_tmp_table_priv: Y Lock_tables_priv: Y Execute_priv: Y Repl_slave_priv: Y Repl_client_priv: Y Create_view_priv: Y Show_view_priv: Y Create_routine_priv: Y Alter_routine_priv: Y Create_user_priv: Y Event_priv: y Trigger_priv: YCreate_tablespace_priv: y ssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0 max_updates: 0 max_connections: 0 max_user_connections: 0 plugin: mysql_native_password authentication_string: password_expired: N1 row in set (0.01 sec)

These are the details of the two methods of how MySQL queries user permissions. Have you gained anything after reading them? If you want to know more about it, welcome to the industry information!

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