Joseph H
Joseph H

Reputation: 1

How can I lock a table in PHPMyAdmin so it can't be modified?

I'm trying to lock a certain table (called gmd_settings) so it can't be modified anymore, but my lack of experience with MySQL and PHPMyAdmin plagues me. I need it explained to me how I would do this in simple terms, to someone that doesn't manage MySQL databases for a living.

Upvotes: 0

Views: 7127

Answers (1)

Isaac Bennetch
Isaac Bennetch

Reputation: 12462

To accomplish this, you should set up proper permissions. MySQL allows you to set permissions not only on a database and table level, but also on individual columns. If you create a new user (or edit the user you're using for this project) and set the permissions you desire, you can limit the user's ability to edit the gmd_settings table. Make sure you don't lock yourself out and I suggest that you make sure you understand what's happening rather than just copying the steps I outline. With that being said, here's what I would do:

Click on the Users tab and the Edit Privileges for the user you wish to edit (or Add a new user).

Near the top, look for the second level of tabs where you can select "Database": Database tab

Then select your database from the list and click Go: Database selector

Next, from the second level of tabs again click on "Table"

Now you have to add permissions for each table. From the dropdown select each table in turn and grant the proper set of permissions. For gmd_settings, that might be only SELECT, for the rest you'll probably at least also need INSERT and UPDATE. Again, these will depend on your configuration and specific needs; you should have some understanding of what you're doing here.

Select-only privileges

Select, Insert, and Update privileges Hopefully that will get you where you want to be.

Upvotes: 1

Related Questions