Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to retrieve user rights from mySQL database?

Status
Not open for further replies.

hmcmysql

Programmer
Sep 15, 2003
3
NL
Hi,

How can i get information from the mySQL database about user rights?
I'm using the c api.
My application consists of a userinterface and when the user fills in some information, this info is sent to the database. However, not all users are allowed to store this info in the database. This means that the user gets the message 'access denied' from the database after he/she filled in the userinterface fields.
I woulds like to inform the user about the userrights before he/she posts new data.
What is the best option here?
 
SELECT Insert_priv FROM mysql.db WHERE user='username' AND db='dbname';

Show Return a Y or N
 
Yes, that is what i was looking for!

Is it also possible to check what the user rights on tables are instead of the complete database, how?
 
SELECT table_priv FROM tables_priv WHERE user='UserID' AND table_name='TableName';
 
Thanx for replying!
This query returns an empty set for my database. Is this caused by the fact i did not assign table specific user rights?
I only granted user rights for the complete database.

 
Yes

This table is only populated when you have table level restrictions.

Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top