绕过密码验证登录mysql
1.修改mysql配置文件
vi /etc/my.cnf
在文件中新增一行skip-grant-tables
2.重启mysql服务
service mysql restart
3.无需密码登录mysql
mysql -uroot -p
4.修改密码
在MySQL 5.7 password字段已从mysql.user表中删除,新的字段名是“authenticalion_string”.
选择数据库:use mysql;
更新root的密码:update user set authentication_string=password(‘新密码‘) where user=‘root‘ and Host=‘localhost‘;
刷新权限:flush privileges;
原文:https://www.cnblogs.com/lroy/p/12445936.html