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

MySQL 账户管理

程序员文章站 2022-06-01 23:05:46
...
[align=center][size=x-large]Mysql 账户管理[/size][/align]
[size=large]1、创建账户[/size]
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'my pass';

[size=large]2、删除账户(删除账户同时会删除其所有权限)[/size]
DROP USER 'jeffrey'@'localhost';

[size=large]3、分配权限[/size]
GRANT ALL PRIVILEGES ON *.* TO 'jeffrey'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION

[size=large]4、回收权限[/size]
REVOKE INSERT ON *.* FROM 'jeffrey'@'localhost';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'jeffrey'@'localhost';

[size=large]5、账户更名[/size]
RENAME USER 'jeffrey'@'localhost' TO 'jeff'@'127.0.0.1';

[size=x-large]6、修改密码[/size]
SET PASSWORD = PASSWORD('mypass');
SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');
相关标签: mysql