Mysql 5.6.20无法用初始密码登陆的解决

    今天尝试安装Mysql 5.6.20的时候,提示初始密码已经创建在~.mysql_secret这个文件里面,然后尝试用这个密码登陆的时候,始终提示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES),尝试各种办法始终不行,最后查询其他人的解决方案,发现用安全模式登陆,然后更改密码是可行的。

   具体步骤:

  ##mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

  ##mysql -u root mysql

  ##select Host, User, Password,password_expired from user where user='root' and host='root' or host='localhost';

  ##update user set password=PASSWORD('Passw0rd') where user='root' and host='root' or host='localhost';

  ##flush privileges;

  ##quti

然后重启mysql,重新登录 就可以解决这个问题

 

  

     


posted @ 2016-01-05 13:54  artleaf  阅读(998)  评论(0编辑  收藏  举报