美文网首页
权限管理

权限管理

作者: cdz620 | 来源:发表于2020-03-05 10:18 被阅读0次

创建账户

  • 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' 并不会回收该用户在各个数据库层面的权限,如果有多个数据库的授权,必须在单个数据库进行回收。

相关文章

网友评论

      本文标题:权限管理

      本文链接:https://www.haomeiwen.com/subject/hladchtx.html