vinpkl — 2011-09-05T04:32:44-04:00 — #1
i would like to know how to give permission to the database user logged in to access or edit only one table and not whole database in phpmyadmin
sjh — 2011-09-05T07:03:52-04:00 — #2
When you say "edit only one table", do you mean alter the structure of the table, or "edit" (ie INSERT, UPDATE, DELETE) the data?
What privileges should the user have for the other tables in the database? Read-only or no access at all?
vinpkl — 2011-09-05T09:41:11-04:00 — #3
Thanks for replying.
Firstly i would like to set permission as "no access" to other tables. But if this is not possible then i would like to set "read-only" permission for other tables.
sjh — 2011-09-05T12:13:20-04:00 — #4
Sure it is.
You didn't say whether the user should be able to edit the table structure or the data in the table. I'm going to assume the latter and show you how to grant read, write and delete access to the table.
If the user account already exists:
GRANT SELECT,INSERT,UPDATE,DELETE ON database_name.table_name TO 'username'@'localhost';
If the user account hasn't been created yet you can set it up at the same time as its permissions:
GRANT SELECT,INSERT,UPDATE,DELETE ON database_name.table_name TO 'username'@'localhost' IDENTIFIED BY 'password';
vinpkl — 2011-09-06T11:57:04-04:00 — #5