How do you lock a table in MySQL so that you cannot edit or drop it no matter what unless you unlock it?
"Locking" a table generally means restricting access to the data in the table by other processes while the data is being edited. To secure a table so that it can't be altered or dropped, I think the best solution would be to change the permissions of the table, removing DROP, UPDATE, INSERT and whatever other permissions you want to restrict, for that specific table.
REVOKE DROP, INSERT, TRUNCATE ON database.table FOR 'user'@'host';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With