zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

mysql - 账号授权

mysql 授权 账号
2023-09-14 09:06:39 时间

登录mysql后才可操作

创建账号

create user 'cenxi'@'%' identified with mysql_native_password by '666cenxi666';

给所有权限

grant all privileges on *.* to 'cenxi'@'%' with grant option;

仅仅给指定库[cxbase]权限

grant all privileges on cxbase.* to 'cenxi'@'%' with grant option;

仅仅给指定库[cxbase]  只读 权限

grant select  on  cxbase.* to 'cenxi'@'%';

清除所有权限

revoke all on *.* from cenxi;

刷新权限

flush privileges;

查看权限

show grants for cenxi

 删除账号

DROP USER 'cenxi'@'%';

注意,如果是高版本或者maraidb

创建并授权指令为

grant all privileges on *.* to 'cenxi'@'%' identified by '密码';

记得刷新
flush privileges;