MySQL 之用户管理

MySQL About 493 words

创建用户

  • %表示全部网络都可以访问
  • 仅本机可以访问,则设置@'localhost'
  • 限定IP访问,则设置@'192.168.1.1'
CREATE USER 'newuser'@'%' IDENTIFIED BY 'zblogpwd';

GRANT SELECT, INSERT, UPDATE ON testdb.* TO 'z-blog'@'%';

查看用户权限

SHOW GRANTS FOR 'newuser'@'%';

新建用户授权其他用户权限

WITH GRANT OPTION

GRANT privileges ON databasename.tablename TO 'newuser'@'host' WITH GRANT OPTION;

撤销用户权限

REVOKE privilege ON databasename.tablename FROM 'newuser'@'host';

用户重命名

rename user 'newuser'@'%' to 'renameuser'@'%';

删除用户

DROP USER 'renameuser'@'host';
Views: 2,662 · Posted: 2019-04-04

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh