MySQL 账户管理
程序员文章站
2022-06-01 23:05:46
...
[align=center][size=x-large]Mysql 账户管理[/size][/align]
[size=large]1、创建账户[/size]
[size=large]2、删除账户(删除账户同时会删除其所有权限)[/size]
[size=large]3、分配权限[/size]
[size=large]4、回收权限[/size]
[size=large]5、账户更名[/size]
[size=x-large]6、修改密码[/size]
[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');
上一篇: 数据库的优化
下一篇: 快速判断是哪个CPU供电管短路的方法