How can I restrict a MySQL user to a particular tables
Assuming the user has no current privileges, you can do the following
GRANT SELECT, INSERT, DELETE ON db_Payroll.tb_Users TO RestrictedUser@'%'
GRANT SELECT, INSERT, DELETE ON db_Payroll.tb_Employees TO RestrictedUser@'%'
Depending on exactly which privileges you wish to grant the user, you can change SELECT, INSERT, DELETE
to something else, e.g. ALL PRIVILEGES
.
Afterwards, remember to flush the privileges so they become effective by running
FLUSH PRIVILEGES;
You can grant access to individual tables by running:
GRANT ALL ON db_Payroll.tb_Users to RestrictedUser@RestrictedHostName;
And similarly for other tables. Use a list of operations instead of ALL
if appropriate.
You cannot grant access to individual tables which do not exist yet without granting access to all tables.