MariaDB用户访问权限设置

创建用户

#创建用户root,可在172.25.254.3登陆,密码为redhat
create user [email protected] identified by "redhat"; 
# 重新查看发现已经添加
select * from mysql.user;

创建远程登陆用户和本地用户

#创建用户hello,可远程登陆,密码为hello
create user hello@'%' identified by "redhat"; 
# 重新查看发现已经添加
select * from mysql.user;
#创建用户hello,可在本机登陆,密码为hello
create user hello@localhost identified by 'hello'; 

用户授权

#给hello@localhost用户授权,如果为all,授权所有权限给hello@localhost用户授权,如果为all,授权所有权限(insert,update,delete,select,create)
grant all on mariadb.* to hello@localhost;
#查看用户授权
show grants for hello@localhost;

撤销权限

#撤销权限
revoke create on *.* from hello@localhost; 
#发现没有create权限了
show grants for hello@localhost;

删除用户

#删除用户
drop user hello@localhost;

你可能感兴趣的:(MariaDB用户访问权限设置)