The mysql just installed can be logged in and can not be logged in after rebooting the machine.

after installing the mysql service, you can use mysql-u root-p , restart the computer and then try to log in
ERROR 1045 (28000): Access denied for user "root"@"localhost" (using password: YES)
how to solve it?

Aug.24,2021

  1. find your mysql configuration file, usually add a line skip-grant-tables under [mysqld] in / etc/mysql.conf,
  2. service mysqld restart restart service
  3. mysql-uroot-p goes directly to mysql
  4. use mysql;
  5. UPDATE user SET PASSWORD = password ("xxxxxx") WHERE USER = 'root';
  6. flush privileges;
  7. exit;
  8. remove skip-grant-tables, from the configuration file and restart the mysqld service again, and log in again to verify the new password

this error is usually caused by the wrong user name and password of the database you want to connect to. Check it carefully.

Menu