MySql数据库------用户授权

 

 

用户授权我们涉及到3个对象:

用户名

密码

主机

用户名

密码

主机

Root

1111

localhost

Root

1111

10.10.65.250

laobian

1234

192.168.1.2

 

1.创建用户

create user laobian@localhost;

2.创建用户并添加密码(123)

create user laobian@localhost identified by "123";

3.创建用户允许远端登录 (允许用户已laobian 登录mysql)

create user laobian@10.10.65.250 identified by"123";

 允许10.10.65.0~10.10.65.255的用户以laobian 登录mysql

create user laobian@'10.10.65.%' identified by "123";

 允许10.10.65.25_~10.10.65.255的用户以laobian 登录mysql

create user laobian@'10.10.65.25_' identified by "123";

 删除用户:

drop user laobian@localhost;

drop user laobian@10.10.65.250;

授权:

select   查询权限

insert   插入权限

update   更新权限

delete  删除权限

create   创建权限

grant command on database.table  to user@host;
 

Grant select on bian.person to laoiban@localhost 将bian数据库的person表的查询权限授权给以localhost登录laobian用户

Grant insert on bian.person to laoiban@localhost 将bian数据库的person表的插入权限授权给以localhost登录laobian用户

Grant delete on bian.person to laoiban@localhost 将bian数据库的person表的删除权限授权给以localhost登录laobian用户

Grant update on bian.person to laoiban@localhost 将bian数据库的person表的更新权限授权给以localhost登录laobian用户

Grant select(id,name) on bian.person to laoiban@localhost 将bian数据库的person表的id和name字段的查询权限授权给以localhost登录laobian用户

Grant select,insert,update,delete on bian.person to laoiban@localhost 将bian数据库的person表的增删改查的查询权限授权给以localhost登录laobian用户

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值