欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Mysql账户管理_MySQL

程序员文章站 2022-05-01 13:37:36
...
bitsCN.com

Mysql账户管理

1、创建账户

Shell代码

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'my pass';

2、删除账户(删除账户同时会删除其所有权限)

Shell代码

DROP USER 'jeffrey'@'localhost';

3、分配权限

Shell代码

GRANT ALL PRIVILEGES ON *.* TO 'jeffrey'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION

4、回收权限

Shell代码

REVOKE INSERT ON *.* FROM 'jeffrey'@'localhost';

REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'jeffrey'@'localhost';

5、账户更名

Shell代码

RENAME USER 'jeffrey'@'localhost' TO 'jeff'@'127.0.0.1';

6、修改密码

Shell代码

SET PASSWORD = PASSWORD('mypass');

SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');

bitsCN.com