MySQL常见用户管理

一、创建用户

A: 使用CREATE USER: CREATE USER '用户名(yms)' IDENTIFIED BY '密码(123456)';

二、修改密码(MySQL 5.7.21)

A: 如果是root:SET PASSWORD=PASSWORD("new_password"); FLUSH PRIVILEGES:

B: 普通用户: SET PASSWORD=PASSWORD("new_Password");

C: update mysql.user set authentication_string=PASSWORD('newPwd'),plugin='mysql_native_password' where user='root';
FLUSH PRIVILEGES:

三、删除用户

A:使用在root权限下DROP方式: DROP USER user1,[,user2]..... ; DROP USER myuser;

B: DELTE FROM user WHERE user="you_user_name" AND host="you_localhsot";

 

你可能感兴趣的:(MySQL,SQL)