SQL DCL Data Control Language, used to define access permissions and security levels;, sqldcl
DCL
1. Create a user
* Create user username @ IP address identified by 'Password ';
> You can only log on to the specified IP address.
* Create user username @ '%' identified by 'Password ';
> Users can log on to any IP address.
2. Authorize the user
* GRANT permission 1 ,... , Permission n ON database. * TO username @ IP Address
> Assign users the specified permissions on the specified database
> For example, GRANTCREATE, ALTER, DROP, INSERT, UPDATE, DELETE, select on mydb1. * TO user1 @ localhost;
* Grant user1 the create, alter, drop, insert, update, delete, and select permissions assigned to the mydb1 database.
* Grant all on database. * TO username @ IP address;
> Assign users all permissions on the specified database
3. Revoke authorization
* REVOKE permission 1 ,... , Permission n ON database. * FROM username @ IP address;
> Revoke the specified permissions of a specified user on a specified database
> For example, revoke create, ALTER, drop on mydb1. * FROM user1 @ localhost;
* Revoke the create, alter, and drop permissions of the user1 user on the mydb1 database.
4. View Permissions
* Show grants for username @ IP Address
> View permissions of a specified user
5. delete a user
* Drop user username @ IP Address