neel1979 — 2012-09-03T04:06:11-04:00 — #1
I want to deactivate truncate operation on a mysql table. So even if someone tries to execute a truncate operation that would fail. How to do that?
cpradio — 2012-09-03T05:35:08-04:00 — #2
Depending on what version of MySQL you are running you either have to deny the DELETE privilege or the DROP privilege.
neel1979 — 2012-09-03T06:02:58-04:00 — #3
My MySQL version is less than 5.1.16. So ideally I need to deny the DELETE privilege. Doing so it won't be possible to delete records from that table anymore which is not possible for my application. I only need to stop the execution of truncate command. What is the alternate approach.
rcashell — 2012-09-03T09:09:56-04:00 — #4
This could be done by creating a stored procedure which performs the delete operation on the table. Set the SQL SECURITY of the stored procedure to DEFINER. The definer of the stored procedure should have delete access on the table. Revoke delete privilege on the table and grant EXECUTE on the stored procedure to the user invoking the stored procedure.
mittineague — 2014-09-18T22:57:44-04:00 — #5
This topic is now archived. It is frozen and cannot be changed in any way.