I wanted to limit a mysql user to read only few fields of a table in a MySQL database. I used select grant privileges command to get the desired output.
For example if a user 'test_user' is requested to access field1, field3 and field6 on the test_table in test_db at 192.168.1.1 server following user creation will work.
The user has to be added at the mysql server running on 192.168.1.1. I have assumed the user test_user is connecting from 192.168.1.2
mysql> GRANT SELECT (`field1` ,`field3`, `field6`) ON `test_db`.`test_table` TO 'test_user'@'192.168.1.2' identified by 'test_pw';
If you want to allow the user to modify the data in the table you may use 'UPDATE' privilege instead of 'SELECT' privilege.
References
For example if a user 'test_user' is requested to access field1, field3 and field6 on the test_table in test_db at 192.168.1.1 server following user creation will work.
The user has to be added at the mysql server running on 192.168.1.1. I have assumed the user test_user is connecting from 192.168.1.2
mysql> GRANT SELECT (`field1` ,`field3`, `field6`) ON `test_db`.`test_table` TO 'test_user'@'192.168.1.2' identified by 'test_pw';
If you want to allow the user to modify the data in the table you may use 'UPDATE' privilege instead of 'SELECT' privilege.
References