mysql用户权限如何批量获取
下文主要给大家带来MySQL用户权限如何批量获取,希望这些文字能够带给大家实际用处,这也是我编辑mysql用户权限如何批量获取这篇文章的主要目的。好了,废话不多说,大家直接看下文吧。
成都创新互联是一家专注于成都网站建设、成都网站制作与策划设计,三都网站建设哪家好?成都创新互联做网站,专注于网站建设十多年,网设计领域的专业建站公司;建站业务涵盖:三都等地区。三都做网站价格咨询:028-86922220
-- 云服务器级别的权限
select a.GRANTEE,GROUP_CONCAT(a.PRIVILEGE_TYPE), concat("grant ",GROUP_CONCAT(a.PRIVILEGE_TYPE)," ON *.* to " ,a.GRANTEE ) from USER_PRIVILEGES a GROUP BY GRANTEE ;
-- db 级别的权限
select GRANTEE,TABLE_SCHEMA,GROUP_CONCAT(PRIVILEGE_TYPE), concat("grant ",GROUP_CONCAT(PRIVILEGE_TYPE)," ON ",TABLE_SCHEMA,".* to " ,GRANTEE ) from information_schema.SCHEMA_PRIVILEGES GROUP BY GRANTEE,TABLE_SCHEMA ;
-- 表级别的权限
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_PRIVILEGES GROUP BY GRANTEE,TABLE_SCHEMA,table_name ;
-- 列级别权限
select GRANTEE,TABLE_SCHEMA,table_name,COLUMN_NAME,GROUP_CONCAT(PRIVILEGE_TYPE) from information_schema.COLUMN_PRIVILEGES GROUP BY GRANTEE,TABLE_SCHEMA,table_name,COLUMN_NAME ;
-- 获取用户权限和密码(密文)
select a.GRANTEE,GROUP_CONCAT(a.PRIVILEGE_TYPE), concat("grant ",GROUP_CONCAT(a.PRIVILEGE_TYPE)," ON *.* to " ,a.GRANTEE ," identified by password '",c.authentication_string,"';" ) privi from USER_PRIVILEGES a left join mysql.user c on a.GRANTEE = concat("'",c.user,"'","@","'",c.host,"'") GROUP BY GRANTEE ;
对于以上关于mysql用户权限如何批量获取,大家是不是觉得非常有帮助。如果需要了解更多内容,请继续关注我们的行业资讯,相信你会喜欢上这些内容的。
文章名称:mysql用户权限如何批量获取
标题路径:http://ybzwz.com/article/jshhid.html