以管理员身份运行cmd(Windows)
cd C:\Program Files\MySQL\MySQL Server 8.0\bin
mysql -uroot -proot
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
问题解决