zoukankan      html  css  js  c++  java
  • 解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)

    一、问题

      有时候我们登录Mysql输入密码的时候,会出现这种情况

      mysql -u root -p 

      Enter Password > '密码'

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

      或者:错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    二、解决办法

      修改my.in/my.cnf配置文件

        进入mysql安装目录

        编辑my.ini

        在[mysqld]下添加skip-grant-tables,保存即可。


      使用管理员身份打开命令行

      ①重启mysql:

        1、net stop mysql    2、net start mysql  


      ②进入mysql,登录
        mysql -u root -p
        不用输入密码,直接回车(出现Enter Password 也一样直接回车,即可登陆成功)


      ③输入use mysql,修改root的密码:
        update user set authentication_string=password('新密码') where user='root';
        flush privileges;


      ④退出:

        quit;


      ⑤再次重启mysql:

        1、net stop mysql     2、net start mysql


      ⑥测试是否成功就是是否登陆成功咯。
        mysql -u root -p

        Enter Password>'新密码'

      就不会出错,可以登录啦!!!

  • 相关阅读:
    windows2003 iis 配置 php
    ORA16038的解决(日志无法归档)
    ORACLE表连接方式分析及常见用法
    (轉)如何计算Oracle内存中的几个命中率
    SQL調整
    婚后
    Automating Database Startup and Shutdown(开机启动和关闭oracle)
    oracle自动启动与停止
    backgroup process
    改变日期的输出格式(nls_date_format)
  • 原文地址:https://www.cnblogs.com/winton-nfs/p/12956811.html
Copyright © 2011-2022 走看看