• mysql不能使用localhost登录


                            解决mysql不能使用localhost or 127.0.0.1登录                                  

    参考:http://soft.chinabyte.com/database/409/12669909.shtml

    因为root账户初始的时候有3条记录,包含root对应localhost,hostname,127.0.0.1三条账户数据,我们可以update host为其他两项中一项为localhost即可。


    1.查询mysql.user表中的用户信息:

    mysql> select host,user,password from mysql.user;
    +---------------+------------------+-------------------------------------------+
    | host          | user             | password                                  |
    +---------------+------------------+-------------------------------------------+
    | localhost     | root             | *DBF26618170E90D83FE55E6BB40FFAF894A58215 |
    | 10-10-244-184 | root             |                                           |
    | 127.0.0.1     | root             |                                           |
    | ::1           | root             |                                           |
    | localhost     |                  |                                           |
    | 10-10-244-184 |                  |                                           |
    | %             | user_game_server | *37A84E9F0D8C7E4B858676FAC681E036C7B55CBC |
    | %             | user_game_select | *04AF85B5140B961767C4B6605D379F4A5F04D94D |
    | %             | db_backup        | *0E6D97610A7A31752267BB2D6BE8AE85923A165E |
    | %             | user_record      | *CE015679C3B849A7AD5797084D8593824C023A1A |
    | %             | record_select    | *38CF7F37D19F2E199904430E889623D94175AA0C |
    | %             | root             | *DBF26618170E90D83FE55E6BB40FFAF894A58215 |
    +---------------+------------------+-------------------------------------------+

    2.解决方法,删除这两个用户:

    delete from mysql.user where host='localhost' and user=' ';

    delete from mysql.user where host='10-10-244-184' and user=' ';

    flush privileges;

  • 相关阅读:
    【BZOJ】2453: 维护队列【BZOJ】2120: 数颜色 二分+分块(暴力能A)
    【转】使用json-lib进行Java和JSON之间的转换
    【转】MySQL索引和查询优化
    【转】SQL常用的语句和函数
    【转】MySQL日期时间函数大全
    VMare中安装“功能增强工具”,实现CentOS5.5与win7host共享文件夹的创建
    MyEclipse中消除frame引起的“the file XXX can not be found.Please check the location and try again.”的错误
    由于SSH配置文件的不匹配,导致的Permission denied (publickey)及其解决方法。
    复选框的多选获取值
    echart环形图制作及出现的一些问题总结
  • 原文地址:https://www.cnblogs.com/tangshengwei/p/5099979.html
Copyright © 2020-2023  润新知