Mysql 5.7 修改密码、远程连接
1.通过本机登录
显示为> mysql 表示登录成功
2.修改密码:
方式1:
update mysql.user set authentication_string=password('root') where user='root' and Host = 'localhost’;
方式2:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
解决办法1:
|- 把密码修改为长一些, 符合【大写 + 小写 + 数字 + 特殊字符】如:alter user ‘root’@‘localhost’ identified by ‘CN.eee.123’;
解决办法2:调整安全策略
参考:https://www.cnblogs.com/ivictor/p/5142809.html
|- set global validate_password_policy=0;
|- set global validate_password_length=1;
再次执行修改密码即可。
3.远程不能访问
mysql> use mysql;
mysql> update user set host = ‘%’ where user = ‘root’;
mysql> FLUSH PRIVILEGES;
4.无密码登录
参考:https://www.cnblogs.com/microtiger/p/7581175.html