DCL(Data Control Language):数据控制语言。
- 创建用户
CREATE USER 用户名@地址 IDENTIFIED BY ‘密码’
CREATE USER user1@localhost IDENTIFIED BY ‘123456’
- 授予权限
GRANT 权限1,权限2,,,ON 数据库.* TO 用户名
GRANT CREATE,DROP ON mydb1.* TO user1@localhost;
- 撤消权限
REVOKE 权限1,权限2,,,ON 数据库.* FROM 用户名
REVOKE CREATE,DROP ONT mydb1.* FROM user1@localhost;
- 查看用户权限
SHOW GRANTS FROM 用户名
SHOW GRANTS FROM user1@localhost;
- 删除用户
DROP USER 用户名
DROP USER user1@localhost;
- 修改密码
UPDATE USER SET
PASSWORD=PASSWORD(‘password’)
WHERE
User=’username’ and Host=”ip”;
FLUSH PRIVILEGES;