Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Permanent Lock on Table

From what I read in the following: http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html, the LOCK TABLES statement is only good for the current session. How can I permanently lock specific tables to make them read-only, for all connection sessions, until I explicitly unlock them?

like image 471
Michael Sheaver Avatar asked Jun 27 '26 01:06

Michael Sheaver


1 Answers

I dont think you can simply lock any table like that. The best way you can do so is to revoke all update, insert and delete privileges

Somthing like this:

REVOKE DROP, INSERT, TRUNCATE ON database.table FOR 'user'@'host'
like image 119
Rahul Tripathi Avatar answered Jun 28 '26 18:06

Rahul Tripathi