mysql用户管理

用户管理

1、  查询用户

use user;

select host,user from user;

2、  创建用户

create user hkx001 IDENTIFIED by 'hkx001';

create user hkx010@127.0.0.1 IDENTIFIED by 'hkx001';

注:[user]@[IP]表示user客户端必须ip地址必须为[IP],才能连接服务端。[IP]支持模糊匹配%_。

3、  修改用户密码

set password for hkx001='hkx002';

4、  重命名用户

rename user hkx001 to hkx002;

5、  删除用户

drop user hkx001;

权限管理

1、  查询权限

show grants for hkx001;

2、  赋予权限

grant select on world.* to hkx001;

 

3、  回收权限

revoke select on world.* from hkx001;

4、  刷新权限

flush privileges;

注:修改用户权限后执行此命令。

5、  权限表

权限

说明

all

 

alter

 

alter routine

使用alter procedure 和drop procedure

create

 

create routine

使用create procedure

create temporary   tables

使用create temporary   table

create user

 

create view

 

delete

 

drop

 

execute

使用call和存储过程

file

使用select into   outfile 和load data infile

grant option

可以使用grant和revoke

index

可以使用create index 和drop index

insert

 

lock tables

锁表

process

使用show full   processlist

reload

使用flush

replication client

服务器位置访问

replocation slave

由复制从属使用

select

 

show databases

 

show view

 

shutdown

使用mysqladmin   shutdown 来关闭mysql

super

 

update

 

usage

无访问权限

原文地址:https://www.cnblogs.com/coshaho/p/7183507.html