mysql grant
时间:2021-07-01 10:21:17
帮助过:7人阅读
grant 权限 on 对象(库.表) to ‘用户名‘@‘主机名‘;
如果是创建用户并授权,可以只需要一条命令执行
grant all on db.tb to ‘username‘@‘localhost‘ identfied by ‘pwd‘;
all 代表所有权限,但是不代表创建的用户有再创建用户,并授权的权限
创建完之后,刷新权限表
flush privileges;
查看用户的权限
show grants for oldboy@‘localhost‘;
mysql> show grants for oldboy@‘localhost‘;
+----------------------------------------------------------------------------+
| Grants for oldboy@localhost |
+----------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO ‘oldboy‘@‘localhost‘ IDENTIFIED BY PASSWORD <secret> |
+----------------------------------------------------------------------------+
1 row in set (0.00 sec)
USAGE :如果你创建的用户没有授任何权限就会显示USAGE
mysql grant
标签:1.7 flush post row user height word blog 主机名