Mysql賬戶管理
1、創建賬戶
Shell代碼
CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'my pass';
www.2cto.com
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';
www.2cto.com
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');