1.查询
说明:查看所有的用户。
use mysql;
SELECT * from user
2.创建用户
说明:指令1是创建用户,它只能从本地主机(localhost
)进行连接。指令2是创建用户,它允许用户从任意主机 (%
) 进行连接。0
CREATE user 'forever'@'localhost' IDENTIFIED by '123456'
CREATE user 'forever'@'%' IDENTIFIED by '123456'
3.登录账号
4.修改用户密码
ALTER user 'forever'@'%' IDENTIFIED with mysql_native_password by '1234';
5.删除用户名
drop user 'forever'@'%';