创建、删除、修改MYSQL 用户和密码

修改 mysql 用户密码的复杂程度(默认为1是中等,1是简单,2是高强度)
SET GLOBAL VALIDATE_PASSWORD_POLICY=0;
SET GLOBAL VALIDATE_PASSWORD_POLICY=1;
SET GLOBAL VALIDATE_PASSWORD_POLICY=2;

CREATE USER 用户名 IDENTIFIED BY ‘密码’;
CREATE USER FEILONG IDENTIFIED BY 'password';

删除user_name这个用户
DROP USER user_name;

修改用户名(old_name 改为 new_name)
RENAME USER old_name TO new_name;

修改当前用户密码
SET PASSWORD = PASSWORD(‘new_password’)

修改用户 feilong 的密码
SET PASSWORD FOR feilong = PASSWORD('new_password');

Comments
Write a Comment