Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a User table with 3 column; name, email, password, etc.

I would like to create another user that can only SELECT the name column.

SELECT name     FROM User;    -- Ok!
SELECT email    FROM User;    -- Not Ok!

Can this be done on MySQL?

share|improve this question
up vote 6 down vote accepted

For this you need to grant select permission to user (MySQL User) on that particular column of table.

GRANT SELECT (name) ON MyDb.User TO 'MySQLUser'@'MySQLHost';

For explanation have a look at MySQL Documentation on column Privileges

share|improve this answer

It would typically be better to use a view to hide columns as needed and then GRANT permissions on the view.

This decouples the table structure and permssions. If you change the table or recreate it, permissions will be lost. Or add a new column that now need separate permissions.

a.k.a add some views to simplify the permission set hierarchy.

share|improve this answer
Views make more troubles than solve: replication, backups, RDS. – Igor Feb 26 at 12:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.