tags:

views:

23

answers:

1

How can I make a single table in mysql read only for a user while he still has write access to other tables in the same db?

Additional info

  • I have root access to the server
  • Tables are MyISAM
  • Server version is 5.0.51a-24+lenny2

thanks!

+2  A: 
GRANT SELECT ON db.table TO user;
GRANT SELECT, INSERT, UPDATE, DELETE ON db.othertable TO user;
Emil Vikström
If this user already has "ALL PRIVILEGES" on this table should i revoke those and assign individual table privileges on each table or can i override the privileges on the single table with SELECT only?
ChrisR
@chris valid question. nevertheless, simply trying this yourself should be a matter of seconds ;)
sfussenegger
True but i'm not really eager to try this on the live database and setting up a test database with the same data is not a matter of seconds :) I will test it tho, lets see how fast i can get a local mirror of the live db :)
ChrisR
You just need to duplicate table structure for this and insert a single row into table in question. No need to mirror entire database.
Mchl