# Solved: How to make just one table read only in MySql



## colinsp (Sep 5, 2007)

I have a MySQL database with 4 tables in it.

I want to make just one of these tables read only. Is there any way to do this easily? I have looked on Google without much success they all seem to talk about making the whole database read-only which is not what I want.

TIA


----------



## DoubleHelix (Dec 10, 2004)

You're probably not finding solutions because you're using the wrong terminology. A table cannot be "read only". Someone, like the database administrator, needs to be able to make changes. Just restrict permissions on the table to read for everyone except the administrator.


----------



## MMJ (Oct 15, 2006)

Not trying to jump to assumptions but I'm sure there is a better solution for whatever problem you have than creating read-only tables.

So, what are you trying to do?


----------



## colinsp (Sep 5, 2007)

What I have is some code that I have downloaded and then modified to suit a website I administer. 

This is a calendar application. It is designed to work with one database with four tables. The admin function allows access to create new calendar entries AND unfortunately the config which sets colours etc. The way this works on the site is that certain people (about 30) have access to the calendar admin function to make new calendar entries. Unfortunately some of them seem to fiddle with the colour config too when they shouldn't. They have been asked not to but unfortunately this is like a red rag to a bull and once every few days I have to go back in to reset the colours so the calendar entries are visible.

I am in the process of building a whole new version of the site and I will be doing it differently in the future. What I wanted was a quick way to stop this happening and wasting my time when it could be better spent building the new site. I thought this might be a quick and easy way to do it.

Any thoughts?


----------



## DoubleHelix (Dec 10, 2004)

As I said, set table permissions. Or column permissions. There are lots of options. I'm guessing you're not familiar with database management. MySQL has online documentation that should describe this in detail.


----------



## colinsp (Sep 5, 2007)

Thanks Doublehelix I'll do that.


----------



## MMJ (Oct 15, 2006)

Just remove the color config from the form.


----------



## colinsp (Sep 5, 2007)

MMJ, I wish I could the colour config is used for display for the rest of the site users and without it the data display would be meaningless.


----------



## MMJ (Oct 15, 2006)

If you want the color config to be there but don't way _anyone_ to change it then just remove the input fields that deal with it. Am I missing something?

Pre-populate the columns in the database if you have to...


----------



## tomdkat (May 6, 2006)

DoubleHelix said:


> As I said, set table permissions. Or column permissions.


Yep, that's what I'm thinking too.

Peace...


----------

