解决MySQL登录报ERROR 1045 (28000): Access denied for user '

原文链接: https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw

解决MySQL登录报ERROR 1045 (28000): Access denied for user ’
root’@‘localhost’ (using password: YES)的问题

  1. 停止mysql数据库: systemctl stop mysqld
  2. 不检查权限的方式启动,执行命令: mysqld –user=root –skip-grant-tables &
  3. 登录mysql: mysql -uroot或mysql
  4. 更新root密码,密码修改为password:UPDATE mysql.user SET authentication_string =PASSWORD(‘password’) WHERE User=‘root’ (mysql 8.0版本)
  5. 刷新: mysql> flash privileges;
  6. 退出: mysql> quit
  7. 重启mysql: sudo service mysqld restart;

你可能感兴趣的:(解决MySQL登录报ERROR 1045 (28000): Access denied for user ')