给mysql添加用户,并赋予相应的权限

来源:互联网 发布:学编程的游戏ios 编辑:程序博客网 时间:2024/05/02 02:19

mysql> grant all on *.* to yushan@"%" identified by "123" ; 
         mysql>flush privileges; (刷新系统权限表)

       (执行完会在MySQL.user表插入一条记录,all表示所有权限(包括增 删 改 查等权限), *.* 表示所有数据库,yushan为添加的用户名,123为密码,%为匹配的所有主机,上面的信息都可以指定如grant select,update on db.* to yushan@localhost identified by '123";)


查看mysql下所用用户

select user,host,password from mysql.user;

查看某个用户的权限

show grants for ‘yanyue’@'%'

删除某个用户的权限

drop user ‘yanyue’@'%'


转载地址:http://blog.csdn.net/lerdor/article/details/12957109

0 0
原创粉丝点击