Jump to content


Photo

Is it possible to "LOCK" a table?


  • Please log in to reply
5 replies to this topic

#1 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 05 July 2006 - 03:25 PM

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!
http://www.DaveLinger.com
dave at linger dot com

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 05 July 2006 - 03:49 PM

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!


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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 DaveLinger

DaveLinger
  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 05 July 2006 - 04:12 PM

but can users still retrieve data from it with a normal non admin account?
http://www.DaveLinger.com
dave at linger dot com

#4 Wildbug

Wildbug
  • Members
  • PipPipPip
  • Advanced Member
  • 1,149 posts

Posted 05 July 2006 - 06:53 PM

but can users still retrieve data from it with a normal non admin account?


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.
Twice a day my clock works PERFECTLY!  I can't figure out what's wrong with it.

#5 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 05 July 2006 - 09:59 PM

You definitely want to use GRANTs, not LOCKs.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#6 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 10 July 2006 - 05:16 PM

You definitely want to use GRANTs, not LOCKs.

agreed
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users