当前位置:Gxlcms > 数据库问题 > MySQL 安全性与访问控制

MySQL 安全性与访问控制

时间:2021-07-01 10:21:17 帮助过:25人阅读

对密码进行明文加密设置 ->select password(456); //能够得到对应的散列值 ->create user zhangsan@localhost identified by123, ->lisi@localhost identified by password ->*531E182E272080AB0740FE2F2D689DBE0156E04; //创建了两个账号,一个zhangsan密码为123,一个lisi,密码为456 ->drop user zhangshan@localhost; //删除张三的账号 ->rename user lisi@localhost to wangwu


 

2、grant权限

实例:授予用户zhangsan在数据库mysql_test的表customers上拥有对列cust_id和列cust_name的select权限

->grant select(cust_id,cust_name)
->on mysql_test.customers
->tozhangsan@localhost;

实例:授予当前系统中一个不存在的用户liming和用户huang,要求创建这两个用户,并设置对应的系统 登录口令,同时授予他们在数据库mysql_test的表customers上拥有select和update的权限

->grant select ,update
->on mysql_test.customers
->toliming@localhost identified by 123,
->huang@localhost identified by 789;

实例:授予系统中已存在的wangwu可以在数据库mysql_test中执行所有数据库操作的权限

->grant all
->on mysql_test.*
->towangwu@localhost;

实例:授予系统中已存在wnagwu拥有创建用户的权限


->grant create user
->on *.*
->to wangwu@localhost;


实例:授予系统中已存在wnagwu拥有创建用户的权限,授予给其他用户


->grant create user
->on *.*
->to wangwu@localhost
->with grant option;

 

MySQL 安全性与访问控制

标签:其他   customer   用户   访问   数据库mysql   数据库   creat   控制   hang   

人气教程排行