zoukankan      html  css  js  c++  java
  • mysql新建用户在本地无法登录

    新建了一个mysql用户,但是无法在本地登录,即使已经授权任一ip都可以登录,甚至特地写清楚localhost登录,还是不行,情况如下

    [root@localhost zabbix-release-3.2]# mysql -ubiaopei -p
    Enter password: 
    ERROR 1045 (28000): Access denied for user 'biaopei'@'localhost' (using password: YES)                  #输入密码报错,但是在其他电脑上输入这个密码后可以正常登录
    

    网上的解决方法乱七八糟的,以后有空再慢慢研究吧。我的解决方法是,不输入密码,直接回车
    情况如下

    [root@localhost zabbix-release-3.2]# mysql -ubiaopei -p
    Enter password:                         #不输密码可以正常登录
    Welcome to the MariaDB monitor.  Commands end with ; or g.
    Your MariaDB connection id is 64
    Server version: 5.5.52-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    MariaDB [(none)]> 
    

    后来也发现,直接回车也不行,需要把允许ip范围改成下面的样子即%才可以

    MariaDB [(none)]> select user,host from mysql.user;
    +---------+-------------+
    | user    | host        |
    +---------+-------------+
    | biaopei | %           |       #运行所有ip地址登录
    | root    | 127.0.0.1   |
    | biaopei | 192.168.2.% |
    | root    | ::1         |
    | root    | localhost   |
    +---------+-------------+
    5 rows in set (0.00 sec)
    
    MariaDB [(none)]> 
    
  • 相关阅读:
    java邮箱发送
    mybaties xml 的头部
    eclipse启动报.log错误
    【高性能网站搭建-learn-web-vitals翻译】——Web Vitals
    【高性能网站搭建-learn-web-vitals翻译】——开篇
    git提交代码步骤以及工作中常用的git命令
    苹果手机focus没有效果 键盘跳不出来
    MVC,MVP与MVVM
    媒体查询用法及常见媒体尺寸
    浏览器内核
  • 原文地址:https://www.cnblogs.com/biaopei/p/7730489.html
Copyright © 2011-2022 走看看