1 创建用户
mysql> CREAT USER ‘paris‘@‘localhost‘ IDENTIFIED BY ‘password‘;
此命令创建一个未授权的用户
2 删除用户
mysql> DROP USER ‘username‘@‘domain‘;
3 GRANT和REVOKE语句允许系统管理员创建MySQL用户账户,授予权限和撤销权限。
以上参考MySQL5.5手册13.5.1
4 也可以直接授权同时创建用户
mysql > GRANT ALL PRIVILEGES ON *.* TO ‘monty‘@‘localhost‘ IDENTIFIED BY ‘some_pass‘ WITH GRANT OPTION;
mysql> GRANT SELECT,INSERT,DELETE,UPDATE ON *.* TO ‘paris‘@‘localhost‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION;
5 改完权限 或者用户 必须刷新授权表
mysql > FLUSH PRIVILEGES;
时间: 2024-11-03 22:05:41