创建账户
- grant all privileges on *.* to 'test1'@'localhost' identified by 'test1' with grant option;
- grant select, update, delete on db.* to 'test1'@'localhost';
- grant select, update, delete on db.* to 'test1'@'10.%.%.%';
- 授权不针对库表的管理权限: grant super,process,file on . to 'test1'@'localhost';
- show grants for test1@'%';
- revoke select, update on . from 'test1'@'localhost'
修改密码
- mysqladmin -u test1 -h localhost oldpassword "newpassword"
- mysql>set password for 'test1'@'localhost' = password('test1')
- grant usage on . to 'test1'@'lodalhost' identified by 'test1'
- update user set password = password('newpassword') where host = 'localhost' and user = 'test1'
删除账号
drop user test1@localhost
注意事项
revoke all privileges on . from 'test1'@'localhost' 并不会回收该用户在各个数据库层面的权限,如果有多个数据库的授权,必须在单个数据库进行回收。
网友评论