zoukankan      html  css  js  c++  java
  • [数据库]mysql MySQL报错-Access denied for user 'root'@'localhost' (using password: NO)

    [数据库]mysql配置连接拒绝无权限解决方法

    https://www.cnblogs.com/bjlhx/p/11395992.html

    1、新安装的mysql报错

    MySQL报错-Access denied for user 'root'@'localhost' (using password: NO)

    解决方案

    1、先停掉原来的服务

    /etc/init.d/mysqld stop

    2、使用安全模式登陆,跳过密码验证

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

    或者上述两步可以使用如下操作

      在mysql的配置文件内加入:

      vim  /etc/my.cnf

      skip-grant-tables

      保存并重启mysql服务

    3、进入mysql,修改密码:

    mysql> use mysql;

    mysql> update user set password=password("你的新密码") where user="root";

    mysql> flush privileges;

    mysql> quit

    到此root账户就重置了密码,

      注意:如果使用配置文件了,需要删除etc/my.cnf中,刚添加的那行内容,重启mysql就好了

    更新密码出错

      mysql> update user set password=password("你的新密码") where user="root";

      报错:ERROR 1054 (42S22): Unknown column 'password' in 'field list'

      解决措施如下:

      mysql>desc user;

      发现在Field列中没有password,此时我们需要这样重置密码:

      mysql>update user set authentication_string=password('123456') where user='root';

  • 相关阅读:
    并查集
    树状数组及二维树状数组
    maven工程编译成jar包
    The Salt Master has rejected this minion's public key!
    salt-minion dead but pid file exists 正确解决方法
    mysql 查找表的auto_increment和修改
    fastjson --JSONObject 和JSONArray 转换
    git 获取当前版本的commitid
    fastjson 使用笔记
    spring IOC 注解@Resource
  • 原文地址:https://www.cnblogs.com/tiaotiaoxia/p/11398564.html
Copyright © 2011-2022 走看看