douyanqu9722 2018-08-17 05:13
浏览 212
已采纳

phpMyAdmin:尽管帐户有密码,但无需输入密码即可以非root用户身份登录

I'm using phpMyAdmin as a part of XAMPP. When I'm prompted with the login screen, I'm able to enter a non-root user account into the Username textfield, leave the Password textfield empty, and be able to login to the account. This is despite the fact that this user account does have a password attached to it. Even stranger, when I do provide the correct password for the user account, I'm given the following two errors and am unable to login:

#1045 - Access denied for user 'usernamehere'@'localhost' (using password: YES)

mysqli_real_connect(): (HY000/1045): Access denied for user 'usernamehere'@'localhost' (using password: YES)

These same errors are also present when I attempt to login using a non-root user account through mysqli_connect() in a php file (whether I provide the password or not).

  • 写回答

2条回答 默认 最新

  • dongxiao3694 2018-08-18 04:24
    关注

    As @Phil says, you're logging in as the anonymous user. When connecting, all three of the username, password, and host need to match. Perhaps the users you're trying to connect as have a different host value from what you're connecting through. If one or more of those (username, password, and host) don't match, you'll either get the error message or logged in as the anonymous user.

    Log in as the anonymous user and look on the main page for the connection information. In the "Database server" area, the first line tells you how you're connected (socket type means your host is 'localhost', TCP/IP networking can be %, or 127.0.0.1, or the actual IP address). Note the connection type, then log out and log back in as the root user. Then edit the users you've created, and modify their host value (or create a new user) to match the host you'll be connecting from. If the connection type was socket, make sure your host is defined with the host 'localhost'. If the connection is TCP/IP, then the exact IP address or the network wildcard % will work (since it's XAMPP, you most likely have MySQL and Apache running on the same machine, so using 127.0.0.1 is more secure than using the wildcard as it only allows local connections).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿