MySQL V8.0.22
[mysqld] # 跳过登录验证 skip-grant-tables
use mysql; update user set authentication_string = '' where User = 'root' and Host = 'localhost'; flush privileges; -- 取消跳过登录验证,再进MySQL正常改密 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; flush privileges;