I am a Mac computer, and this problem occurred in the process of using mysql. The
solution is as follows
: Step 1: SET PASSWORD = PASSWORD('your new password');
Step 2: ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Step 3: flush privileges;
Complete the above three steps to log out and log in again, just use the newly set password. Except for the red one that is changed to a new password, you can enter the rest as it is.