首页 > 数据库技术 > 详细

mysql 新建用户,赋予权限

时间:2014-11-01 16:13:26      阅读:256      评论:0      收藏:0      [点我收藏+]

mysql 创建一个用户 hail,密码 hail,指定一个数据库 haildb 给 hailmysql -u root -ppassworduse mysql;insert into user(ho

mysql 创建一个用户 hail,密码 hail,指定一个数据库 haildb 给 hail


mysql -u root -p

password

use mysql;

insert into user(host,user,password) values(‘localhost‘,‘hail‘,password(‘hail‘));

flush privileges;

create database haildb;

grant all privileges on haildb.* to hail@localhost identified by ‘hail‘;

flush privileges;

如果想指定部分权限给用户


grant select,update on haildb.* to hail@localhost identified by ‘hail‘;

flush privileges;

删除用户


delete from user where user=‘hail‘ and host=‘localhost‘;

flush privileges;

删除用户数据库


drop database haildb;

修改指定用户密码


update user set password=password(‘new_password‘) where user=‘hail‘ and host=‘localhost‘;

flush privileges;

mysql 新建用户,赋予权限

原文:http://www.cnblogs.com/sbfnxk201/p/4067246.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!