How to provide Select permission to limited tables in MySQL Database - MySQL DBA Tutorial

How to provide Select permissions to user on limited Tables in MySQL Database 


Below Syntax can be used to provide select permission on table/s in MySQL.

Syntax:

To provide Select permission on Single Table in MYSQL


MySQL > GRANT select ON tableName to 'UserName'@'Host' 


If you would like to provide select permission on all the tables in a database
 MySQL > GRANT select ON DatabaseName.* to 'UserName'@'Host' 

Example :
Let's say that if we have table test in Techbrothers Database and we would like to provide Select permission to user "Aamir" in MySQL. we can use below statement


MySQL > GRANT select ON Techbrothers.test to 'Aamir'@'localhost' 
If we want to provide Select permission on all the tables in Techbrothers Database to user account Aamir in MySQL, we can use below statement


MySQL > GRANT select ON Techbrothers.* to 'Aamir'@'localhost' 

Grant Select privilege to Table or Tables in MySQL server to user

2 comments: