• ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N)


    刚使用mysql, 就老是碰到这个问题,真是郁闷, 终于找到原因..
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
    ERROR 1045 (28000): Access denied for user (using password: N
    O)


    解决方法:
    Step 1:

    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u root -p
    Enter password: ******
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 28 to server version: 5.0.24a-community-nt

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    Step 2:
    C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
    mysql>status

    正常使用....

    --------------------------------------------------

    我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
    # mysql -uroot -p
    Enter password:
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    使用网上介绍的方法修改root用户的密码:
    # mysqladmin -uroot -p password 'newpassword'
    Enter password:
    mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user 'root'@'localhost' (using password: YES)'

    现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
    方法一:
    # /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>

    mysql>


    方法二:
    直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
    # mysql -udebian-sys-maint -p
    Enter password: <输入[client]节的密码>
    mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit

    # mysql -uroot -p
    Enter password: <输入新设的密码newpassword>

    mysql>


    方法三:
    这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!!
    # mysql -uroot -p
    Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码>

    至此,困惑多时的问题解决了!

    Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1683765

  • 相关阅读:
    [CF 803G]- Periodic RMQ Problem 动态开点线段树 或 离线
    [2018CCPC吉林赛区(重现赛)- 感谢北华大学] 补题记录 躁起来
    【EDU68 E】 Count The Rectangles 数据结构算几何
    【HDU5409】CRB and Graph 边双联通 子树最值
    【CF1137C】 Museums Tour 拆点+缩点
    【HDU6035】 Colorful Tree
    【Edu 67】 补题记录
    五月月赛 寻宝 exkmp + 主席树
    ZOJ
    CF 551 D.Serval and Rooted Tree 树形DP
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4400471.html
Copyright © 2020-2023  润新知