You must reset your password using ALTER USER

On MySQL 8, when you start MySQL, it generate a temporary root password, that you can find with command

When i try run some SQL commands after login with this temporary password, i get error

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

To fix this, you need to change your MySQL root password by running

MySQL 8 on CentOS Change MySQL Root Password

2 thoughts on “You must reset your password using ALTER USER

  1. Wow.. It’s just need localhost.. so sad lah…
    I use it without localhost on MySQL 8.0.2 windows 64 bit. adding localhost as host on updateting the database solve the problem. Thank you
    This also work on windows 10

    1. hi Benyamin,
      I use win 10. I installed mysql. It generated a temporary password for mysql root. Then I created a user with some permissions. yesterday the userlogin was working fine. Today it shows the error.

      C:\myWebProject\mysql\bin>mysql -u myuser -p
      Enter password: *****
      ERROR 1045 (28000): Access denied for user ‘myuser’@’localhost’ (using password: YES)

Leave a Reply

Your email address will not be published. Required fields are marked *