首页 >数据库 >mysql教程 >mysql 创建一个用户,指定一个数据库_MySQL

mysql 创建一个用户,指定一个数据库_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-01 13:28:191333浏览

bitsCN.com

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;

删除用户

deletefrom 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;

bitsCN.com
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn