日期:2014-05-16  浏览次数:20651 次

MySQL 账户管理
Mysql 账户管理

1、创建账户
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'my pass';

2、删除账户(删除账户同时会删除其所有权限)
DROP USER 'jeffrey'@'localhost';

3、分配权限
GRANT ALL PRIVILEGES ON *.* TO 'jeffrey'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION

4、回收权限
REVOKE INSERT ON *.* FROM 'jeffrey'@'localhost';
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'jeffrey'@'localhost';

5、账户更名
RENAME USER 'jeffrey'@'localhost' TO 'jeff'@'127.0.0.1';

6、修改密码
SET PASSWORD = PASSWORD('mypass');
SET PASSWORD FOR 'jeffrey'@'localhost' = PASSWORD('mypass');