开发者社区 问答 正文

Red Hat 5 安装Mysql5.6 无法登录的原因?

RPM 装完 执行mysql 出现 ERROR 1045 (28000): Access denied for user 'root'@'localhost'
什么原因,怎么解决。

展开
收起
落地花开啦 2016-02-15 15:19:14 2377 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    修改命令
    # /etc/init.d/mysql stop
    # mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
    # mysql -u root mysql
    `mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit`

    # /etc/init.d/mysql restart
    # mysql -uroot -p
    Enter password: <输入新设的密码newpassword>

    2019-07-17 18:43:18
    赞同 展开评论