开发者

C# connecting to MySQL -get DB user rights?

开发者 https://www.devze.com 2022-12-10 00:44 出处:网络
I am using System.data.odbc to communicate with my MySQL db. When logged, I would need to know whather the user is admin or not, just to know the rights. Is there any way how to retrieve rights of c开

I am using System.data.odbc to communicate with my MySQL db. When logged, I would need to know whather the user is admin or not, just to know the rights. Is there any way how to retrieve rights of c开发者_运维问答urrently logged user? Thank you!


There's a SHOW command to retrieve the current user's grants:

SHOW GRANTS

If you don't have the SELECT privilege, SHOW GRANTS will throw an error :)

There's also an INFORMATION_SCHEMA table you can select from:

select * from information_schema.user_privileges
0

精彩评论

暂无评论...
验证码 换一张
取 消