mysql 用户授权相关

转自:https://www.cnblogs.com/idlo/p/10872324.html

创建用户:

CREATE USER 'local_user' IDENTIFIED BY '123456';

赋予所有权限:

# 赋予 local_user 所有权限
GRANT all ON *.* TO 'local_user'@'%';
# 刷新权限(需要更新并重新连接)
FLUSH PRIVILEGES;
# 查看权限
SELECT * FROM user WHERE `user` = 'local_user';

回收权限:

REVOKE all ON *.* FROM 'local_user'@'%';

删除用户:

DROP USER 'local_user'@'%';
posted @ 2020-03-16 19:22  不是豆豆  阅读(96)  评论(0编辑  收藏  举报
友情链接:迷途