更改root密码,需要带数字,大写字母,小写字母,特殊符号
alter user 'root'@'localhost' identified by 'Qaz123456!@#$';
# 设置密码永不过期
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
# 刷新MySQL的系统权限相关表
flush privileges;
10、开启远程登录
grant all privileges on *.* to root@"%" identified by "你的密码";
grant all privileges on *.* to root@"localhost" identified by "你的密码";
flush privileges;
新建用户
CREATE USER 'xld_test'@'%' IDENTIFIED BY '你的密码';
用户授权
添加用户权限:
GRANT ALL ON databasename.tablename TO 'xld_test'@'%';
撤销用户权限:
REVOKE ALL ON databasename.tablename TO 'xld_test'@'%';
删除用户及权限 :
drop user 'xld_test'@'%';