mysql and java: check if user hat right to change database structure
Posted on 2011-09-19
in a java project i would like to check a database user if he has right of change database structure. (such as drop_priv, alter_priv, delete_priv)
the first question is: how do i check the drop right of 'myuser' , who has localhost as host.
here some details:
in mysql, i have tried to use
select Delete_priv from mysql.user where User='myuser';
to find if use has delete right. but the result i got is "Yes" and "No". because in database there are two users with the same name, one has "localhost" as host, another has "%" as host.
second question is: how do i get the result of sql above in java code?