时间:2021-07-01 10:21:17 帮助过:27人阅读
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');