mysql补遗3

来源:互联网 发布:股票网络销售好做吗 编辑:程序博客网 时间:2024/04/27 21:54
 小结权限的相关操作

1 创建帐号
  grant all privileges on *.* to z1@localhost;
       *.*表示对本地所有数据库及表都有权限,可以改为on test.user ,则对test数据库的user表有权限。
  限制IP及加上密码
  grant select,insert,update..... on test1.* to 'z1'@'localhost' identified by '密码'
也可以用 on test.* to 'z1'@'%',表示可以从任意主机连接过去。

2 只授予某用户登陆权限,其他什么都看不到
  grant usage on *.* to 'z4'@'localhost';
3  查看某用户有的权限
    show grants from z1@localhost;
  查看Z1用户的权限。
4 收回权限
  revoke select,insert on *.* from z2@localhost;

5 安全原则
  A 不要用root帐号登陆
  B 除root外,任何用户不应该有mysql库和user表库的权限
  C 不要把file,process或super权限授予管理员以外的帐号

 
原创粉丝点击