DCL
1. 创建用户
* CREATE USER username@IP地址 IDENTIFIED BY 'password';
> 用户仅仅能在指定的IP地址上登录
* CREATE USER username@'%' IDENTIFIED BY 'password';
> 用户能够在随意IP地址上登录
2. 给用户授权
* GRANT 权限1, … , 权限n ON 数据库.* TO username@IP地址
> 给用户分派在指定的数据库上的指定的权限
> 比如;GRANTCREATE,ALTER,DROP,INSERT,UPDATE,DELETE,SELECT ON mydb1.* TO user1@localhost;
*给user1用户分派在mydb1数据库上的create、alter、drop、insert、update、delete、select权限
* GRANT ALL ON 数据库.* TO username@IP地址;
> 给用户分派指定数据库上的全部权限
3. 撤销授权
* REVOKE 权限1, … , 权限n ON 数据库.* FROM username@IP地址;
> 撤消指定用户在指定数据库上的指定权限
> 比如;REVOKE CREATE,ALTER,DROP ON mydb1.*FROM user1@localhost;
* 撤消user1用户在mydb1数据库上的create、alter、drop权限
4. 查看权限
* SHOW GRANTS FOR username@IP地址
> 查看指定用户的权限
5. 删除用户
* DROP USER username@IP地址