Mysql permission to single table

hi all

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

vineet

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?

hi SJH

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.

vineet

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';

thanks SJH