您好,欢迎来到速财网。
搜索
您的当前位置:首页mysql创建一个用户,指定一个数据库_MySQL

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

来源:速财网


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

Copyright © 2019- insurancechain.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务