Jump to content

Archived

This topic is now archived and is closed to further replies.

DaveLinger

Is it possible to "LOCK" a table?

Recommended Posts

we're having a problem somewhere and our configuration table keeps getting changed. Is there a way in MySQL to LOCK a table so it cannot be changed unless it is UN LOCKED?

Thanks!

Share this post


Link to post
Share on other sites
[quote author=DaveLinger link=topic=99529.msg391983#msg391983 date=1152113100]
we're having a problem somewhere and our configuration table keeps getting changed. Is there a way in MySQL to LOCK a table so it cannot be changed unless it is UN LOCKED?

Thanks!
[/quote]

the best way to do that is to create the configuration table with an administrative account, and don't grant update rights to the user that the web application is using. that way, you can't "accidentally" or in any other way update the table without manually logging in with the database administrator account and changing them.

Share this post


Link to post
Share on other sites
but can users still retrieve data from it with a normal non admin account?

Share this post


Link to post
Share on other sites
[quote author=DaveLinger link=topic=99529.msg392007#msg392007 date=1152115944]
but can users still retrieve data from it with a normal non admin account?
[/quote]

Sure, read the manual section on GRANT usage.  You'll see what types of permissions can be granted to users.  You'd probably want an administrative account with GRANT ALL, but only SELECT permissions for a normal web user.

Share this post


Link to post
Share on other sites
You definitely want to use GRANTs, not LOCKs.

Share this post


Link to post
Share on other sites
[quote author=fenway link=topic=99529.msg392220#msg392220 date=1152136750]
You definitely want to use GRANTs, not LOCKs.
[/quote]
agreed

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.