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条)

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况