mysql实现用户的三权分离

作者: 来源:本站原创 点击数: 发布时间:2024年03月14日

问题描述:三级等保要求,mysql实现用户的三权分离

解决办法:

mysql -uroot -p 登录mysql命令窗口

1.创建系统管理员 --- 管理数据的权限,增,删,改,查

CREATE USER 'sysadmin'@'%' IDENTIFIED BY 'Sysadmin2024!@#';

GRANT SELECT, INSERT, UPDATE, DELETE  ON *.* TO 'sysadmin'@'%' IDENTIFIED BY 'Sysadmin2024!@#' WITH GRANT OPTION;

FLUSH PRIVILEGES;

查看用户权限 : SHOW GRANTS FOR 'sysadmin'@'%'


2.创建安全管理员用户并授权 --- 具有授权用户的权限

CREATE USER 'operator'@'%' IDENTIFIED BY 'Operator2024!@#';

GRANT CREATE,DROP,ALTER ON *.* TO 'operator'@'%'  WITH GRANT OPTION;

FLUSH PRIVILEGES;

查看用户权限: SHOW GRANTS FOR 'operator'@'%'


3. 创建审计管理员-- 具有查看数据,审计日志的权限

CREATE USER 'auditor'@'%' IDENTIFIED BY 'Auditor2024!@#';

GRANT SHOW DATABASES,SHOW VIEW,SELECT ON *.* TO 'auditor'@'%'  WITH GRANT OPTION;  

FLUSH PRIVILEGES;

查看用户权限: SHOW GRANTS FOR 'auditor'@'%'