I am tormented by the problem of obtaining information about whether the user has rights to certain commands to certain tables. For example, there is a user user and he has SELECT rights in table1, as well as SELECT, DELETE rights in table2. How to determine if the user has rights to delete specifically for the table table2?
If you use the command:
SHOW GRANTS FOR user; then all user privileges are displayed, which in turn is difficult to automatically process (more precisely, I cannot imagine how to choose DELETE from a changing output that will apply to table2 and not to be confused with other tables.)
If you use the command:
SELECT * FROM information_schema.user_privileges; then not all privileges are displayed (in my case, only one USAGE privilege is displayed),
If use command
USE information_schema; SELECT TABLE_NAME, PRIVILEGES FROM COLUMNS; then the privileges are displayed only those that match the list "select, insert, update, references" i.e. in my case DELETE is not here.
Is it really impossible to find out whether the user has certain rights?