Hi,
Is there any permission or grant command on a table which make users not able to delete records (row) that inserted by another user. But allow them to delete or update their own record?
Thanks, Stephen
Hi,
Is there any permission or grant command on a table which make users not able to delete records (row) that inserted by another user. But allow them to delete or update their own record?
Thanks, Stephen
No, this should be addressed by the application that runs on top of MySQL.
Not entirely sure the following's workable for your case, but I thought I might as well suggest it -- perhaps it can help. You could create for each user an updatable view (with sql security definer
) that selects only those user's records, and grant the user the ability to delete on the view but not the table it selects from -- with sql security definer
, the user should then be able to delete from the view causing deletion from the table. You'll also have to update the view each time the user creates a new record (otherwise the view is "frozen" at the time it was created). See the docs for create view and updatable views.
u should implement acl with a programming language. some libraries like zend do the job for u (using php language).