MySQL8.0解决 ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES) 问题

使用的版本是mysql8.0的版本;

出现错误:

 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES);

第一步:关闭  net stop mysql   这个需要cmd的管理员权限;

第二步:在安装MySQL的bin目录 执行 :mysqld --console --skip-grant-tables --shared-memory

第三步:启动一个新的cmd窗口   执行   mysql -uroot -p    就能免密进入

第四部修改密码:

   1.  use mysql;

   2. update user set authentication_string='' where user='root';      如果这个字段有值,先置为空

   3. flush privileges;     刷新权限表

   4.ALTER user 'root'@'localhost' IDENTIFIED BY '123456';     修改root 密码

就OK了

猜你喜欢

转载自blog.csdn.net/qq_38786110/article/details/105792988