如何将MySQL数据库中的user_account限制为特定表。例如:
UserName: RestrictedUser DatabaseName: db_Payroll TableName: tb_Employees tb_Users tb_Payroll_YYMMDD tb_Payroll_Processed
我只想将“ RestrictedUser”限制为tb_Users,tb_Employees并且db_Payroll将创建该表的其余表以供将来使用,并授予其访问权限。
tb_Users
tb_Employees
db_Payroll
假设用户没有当前权限,则可以执行以下操作
GRANT SELECT, INSERT, DELETE ON db_Payroll.tb_Users TO RestrictedUser@'%' GRANT SELECT, INSERT, DELETE ON db_Payroll.tb_Employees TO RestrictedUser@'%'
根据您希望授予用户的特权,您可以更改SELECT, INSERT, DELETE为其他内容,例如ALL PRIVILEGES。
SELECT, INSERT, DELETE
ALL PRIVILEGES
之后,请记住清除特权以使其生效。
FLUSH PRIVILEGES;