1、创建用户
mysql> create user 'myself'@'%' identified by 'Myself'; Query OK, 0 rows affected mysql>
2、赋予权限
mysql> grant select,update,insert,update on scms.* to 'myself'@'%'; Query OK, 0 rows affected mysql>
3、查询权限
mysql> show grants for 'myself'@'%'; +----------------------------------------------------------+ | Grants for myself@% | +----------------------------------------------------------+ | GRANT USAGE ON *.* TO 'myself'@'%' | | GRANT SELECT, INSERT, UPDATE ON `soms`.* TO 'myself'@'%' | | GRANT SELECT, INSERT, UPDATE ON `scms`.* TO 'myself'@'%' | +----------------------------------------------------------+ 3 rows in set mysql>
4、收回权限
mysql> revoke select,update,insert,update on scms.* from 'myself'@'%'; Query OK, 0 rows affected mysql>
5、修改用户
mysql> rename user 'myself'@'%' to 'myself-test'@'%'; Query OK, 0 rows affected mysql>
6、删除用户
mysql> drop user 'myself-test'@'%'; Query OK, 0 rows affected mysql>