zoukankan      html  css  js  c++  java
  • 连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法

    linux系统

    1,在Linux,先进入/etc,修改my.cnf,任意一行加上"skip-grant-tables"。

    2,重启MySQL:service mysqld restart

    3,use mysql;

    update mysql.user set authentication_string=password('your new password') where user='root';

    4,flush privileges;

            exit;
    5,重启MySQL:service mysqld restart  (这步可以省略)

    windows系统

    版本是5.7

    1、默认安装地址:C:ProgramDataMySQLMySQL Server 5.7

     2、打开my.ini,在mysqld下面加上  skip-grant-tables

    表示不用密码就可以登录。

    3、打开电脑的服务,重启MySQL服务。

    4、进入MySQL命令行

     不用输入密码,直接进入

    5、use mysql;

    update mysql.user set authentication_string=password('your new password') where user='root';

    flush privileges;

    6、再回到my.ini,给skip-grant-tables加上“#”,表示注释掉。

    7、重启MySQL服务,即可。

  • 相关阅读:
    企业云盘安全性如何 怎样部署
    Sentinel 控制台部署
    nginx代理静态页面添加二级目录
    java socket
    IDEA
    golang代码生成器
    es 单节点问题
    代码模板
    错误摘要 HTTP 错误 403.14
    安装.Net Framework 4.6.2无法安装的2种情况
  • 原文地址:https://www.cnblogs.com/luoa/p/10843980.html
Copyright © 2011-2022 走看看