下文主要給大家?guī)?lái)MySQL用戶權(quán)限如何批量獲取,希望這些文字能夠帶給大家實(shí)際用處,這也是我編輯mysql用戶權(quán)限如何批量獲取這篇文章的主要目的。好了,廢話不多說(shuō),大家直接看下文吧。
成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站建設(shè)、成都網(wǎng)站制作與策劃設(shè)計(jì),三都網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十多年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:三都等地區(qū)。三都做網(wǎng)站價(jià)格咨詢:028-86922220
-- 云服務(wù)器級(jí)別的權(quán)限
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 級(jí)別的權(quán)限
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 ;
-- 表級(jí)別的權(quán)限
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 ;
-- 列級(jí)別權(quán)限
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 ;
-- 獲取用戶權(quán)限和密碼(密文)
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 ;
對(duì)于以上關(guān)于mysql用戶權(quán)限如何批量獲取,大家是不是覺(jué)得非常有幫助。如果需要了解更多內(nèi)容,請(qǐng)繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會(huì)喜歡上這些內(nèi)容的。