mysql数据库权限用户操作,远程登录-- 【读写权限控制】:

– 【读写权限控制】:

  • [创建用户]
CREATE USER IF NOT EXISTS 'company_only'@'localhost' IDENTIFIED WITH
	mysql_native_password BY 'company_pass';
  • [刷新]
FLUSH PRIVILEGES;
  • [授权]
GRANT SELECT ON company.* TO 'company_only'@'localhost';
  • [授权读写]
GRANT INSERT,DELETE,UPDATE ON company.* TO 'company_only'@'localhost';
  • [字段进行授权]
GRANT SELECT(salary) ON employees.salaries TO 'employees_ro'@'localhost';
  • [超级管理]
GRANT ALL ON *.* TO 'dbadmin'@'localhost';
	GRANT GRANT OPTION ON *.* TO 'dbadmin'@'localhost';
  • [查询权限]
SHOW GRANTS FOR 'company_only'@'localhost';
  • [撤销权限]
REVOKE DELETE ON company.* FROM 'company_only'@'localhost';
  • [锁定用户]
ALTER USER 'company_only'@'localhost' ACCOUNT LOCK;
  • [解锁用户]

ALTER USER ‘company_only’@‘localhost’ ACCOUNT UNLOCK;

  • [时间间隔修改密码 1天后需要修改密码]
ALTER USER 'company_only'@'localhost' PASSWORD EXPIRE INTERVAL 1 DAY;
发布了8 篇原创文章 · 获赞 0 · 访问量 779
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览