学习笔记

Study notes

mysql帐号权限赋予

云逐梦12952017-02-09 06:50:00返回列表

查看当前数据库中有哪些权限账号

mysql -uroot -h127.0.0.1 -p密码


用户管理

use mysql;打开mysql

查看当前数据库中有哪些权限账号

select host,user,password from user;

查看root帐号下的权限

show grant for ‘root’@‘localhost'


添加帐号

帐号的名称@主机名

主机名:可以是ip地址也可以是localhost


创建一个zy的帐号,赋予一个select权限

grant select on *.* to zy@localhost indentified by ‘123456’ with grant option;

revoke select on *.* from zy@localhost; //重新赋select ,delete权限

grant select,delete on *.* to zy@localhost indentified by ‘123456’ with grant option;


grant all privileges on test.* to test1@localhost indentified by ‘123456’ width grant option;

//给数据库test添加了一个test1帐号,可以对数据库test进行所有的操作


删除账号:

drop user ‘zy’@localhost;


修改帐号密码:

set password for ‘帐号名’@‘%’ = password(‘新密码');


对账号权限的资源设置

创建一个zy帐号,在test数据库上有select权限,每个小时查询的次数小于5次,最多同时有6个用户进行并发连接

grant select on test.* to zy@localhost indentified by ‘123456’ with max_queries_per_hour 5 max_usr_connections 6;


返回
顶部