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 obtain mysql user Rights in batches

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

The following mainly brings you how to obtain mysql user rights in batches. I hope these words can bring you practical use, which is also the main purpose of how I edit mysql user rights to obtain this article in batches. All right, don't talk too much nonsense, let's just read the following.

-- permissions at the CVM level

Select a.GRANTEEEE GROUPPRONCONcat (a.PRIVILEGE_TYPE), concat ("grant", GROUP_CONCAT (a.PRIVILEGE_TYPE), "ON *. * to", a.GRANTEE) from USER_PRIVILEGES a GROUP BY GRANTEE

-- permissions at db level

Select GRANTEE,TABLE_SCHEMA,GROUP_CONCAT (PRIVILEGE_TYPE), concat ("grant", GROUP_CONCAT (PRIVILEGE_TYPE), "ON", TABLE_SCHEMA, ". * to", GRANTEE) from information_schema.SCHEMA_PRIVILEGESGROUP BY GRANTEE,TABLE_SCHEMA

-- Table-level permissions

Select GRANTEE,TABLE_SCHEMA,table_name,GROUP_CONCAT (PRIVILEGE_TYPE), concat ("grant", GROUP_CONCAT (PRIVILEGE_TYPE), "ON", TABLE_SCHEMA, ".", table_name, "to", GRANTEE) from information_schema.TABLE_PRIVILEGESGROUP BY GRANTEE,TABLE_SCHEMA,table_name

-column level permissions

Select GRANTEE,TABLE_SCHEMA,table_name,COLUMN_NAME,GROUP_CONCAT (PRIVILEGE_TYPE) from information_schema.COLUMN_PRIVILEGESGROUP BY GRANTEE,TABLE_SCHEMA,table_name,COLUMN_NAME

-- obtain user permissions and passwords (ciphertext)

Select a.GRANTEEEE GROUPPERCONcat (a.PRIVILEGE_TYPE), concat ("grant", GROUP_CONCAT (a.PRIVILEGE_TYPE), "ON *. * to", a.GRANTEE, "identified by password'", c.authentication_string, "';") privifrom USER_PRIVILEGES a left join mysql.user con a.GRANTEE = concat ("'", c.user, "'", "@", "", c.host, "'") GROUP BY GRANTEE

For the above about how to obtain mysql user rights in batches, do you think it is very helpful? If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

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