@[TOC]
1 用户管理
1.1 查询用户
USE mysql;
SELECT * FROM user;
1.2 创建用户
CREATE USER '用户名'@'主机名' IDENTIFIED BY '123456';
-- 允许所有主机链接
CREATE USER 'siyuan'@'%' IDENTIFIED BY '123456';
1.3 修改用户密码
ALTER USER '用户名'@'主机名' IDENTIFIED WITH mysql_native_password BY '123456';
1.4 删除用户
DROP USER '用户名@'主机名';
2 权限控制
2.1 查询用户权限
show grants for 'siyuan'@'localhost';
2.2 授予权限
grant all on `ry-vue`.* to 'siyuan'@'localhost';
2.3 取消权限
revoke all on `ry-vue`.* from 'siyuan'@'localhost'
2.4 多个权限用逗号隔开:
ALL,ALL PRIVILEGES,SELECT,INSERT,UPDATE,DELETE,ALTER,DROP,CREATE