关于Mysql用户的相关操作
基于MySQL 8
如有遗漏,欢迎补充
SELECT * FROM `user`;
#创建用户
CREATE USER `zjm`@`%` IDENTIFIED BY '@GirlFriend999';
#重命名
RENAME USER `zjm`@`%` TO `zjmm`@`%`;
RENAME USER `zjmm` TO `zjm`;
#授权
/*
所有可以授予的权限:
INSERT,SELECT,UPDATE, DELETE, CREATE, DROP
REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER
*/
GRANT SELECT ON girls.`beauty` TO zjm;
GRANT ALL ON girls.`admin` TO zjm WITH GRANT OPTION;
GRANT ALL ON test.* TO zjm;
#修改密码
SET PASSWORD FOR zjm = '@XXXXXxxxxxxx233';
#查看权限
SHOW GRANTS FOR zjm;
#回收权限
REVOKE INSERT ON girls.`admin` FROM zjm;
#刷新权限
FLUSH PRIVILEGES;
如需转载,请注明出处
如有侵权,联系删除
2290713181@qq.com
如有侵权,联系删除
2290713181@qq.com