一 、2058错误
通过命令行进入MySQL,执行如下命令:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'
截图:
二、1251错误
通过命令行进入MySQL,执行如下命令:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
FLUSH PRIVILEGES; #刷新权限
截图:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.05 sec)mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
Query OK, 0 rows affected (0.01 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)mysql>