在phpMyAdmin中使用SHA256设置用户密码后,访问被拒绝 [英] Access denied after setting user's password with SHA256 in phpMyAdmin

查看:82
本文介绍了在phpMyAdmin中使用SHA256设置用户密码后,访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看到phpMyAdmin生成的默认密码使用了mysql_native_password,因此当使用相同的密码时哈希没有改变,我更新了一个用户的密码并将哈希设置为SHA256.

After seeing that default passwords generated by phpMyAdmin used mysql_native_password and therefore hashes didn't changed when equal passwords where used, I updated one user's password and set the hashing to SHA256.

当我尝试使用设置的密码再次登录时,它说:

When I tried to login again using the setted password it says:

mysqli_real_connect():(HY000/1045):用户'xxxx'@'xxxx'的访问被拒绝(使用密码:是).

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

服务器使用https,而phpMyAdmin强制也使用SSL.

The server uses https and phpMyAdmin forces to uses SSL as well.

使用SHA256更改密码后,再次获得访问权限的唯一方法是手动设置密码并将密码插件恢复为mysql_native_password.

Once the password is changed with SHA256, the only way to gain access again is manually setting the password and reverting password plugin to mysql_native_password.

如何使用SHA256密码与用户登录phpMyAdmin?

How can I login to phpMyAdmin with users using SHA256 passwords?

注意:如果我尝试使用相同的用户名和SHA256密码登录到mysql控制台,则可以正常工作.

Note: if I try to use the same user and the SHA256 password to login to mysql console it works fine.

推荐答案

MySQL最近更改了默认身份验证类型,并且在MySQL和PHP之间,此更改花费了相当长的一段时间才能得到PHP的支持.旧方法是mysql_native_password,新方法是caching_sha2_password.从7.4开始的PHP版本支持新方法.由于这与PHP本身相关,因此支持此方法的phpMyAdmin要求您运行更新的PHP安装(phpMyAdmin本身已准备好进行此更改,但使用它的能力取决于您的PHP版本).

MySQL has recently changed the default authentication type and, between MySQL and PHP, this change took quite a while to be supported by PHP. The old method was mysql_native_password and the new one is caching_sha2_password. PHP versions starting with 7.4 support the new method. Since this is related to PHP itself, phpMyAdmin supporting this method requires you to run an updated PHP installation (phpMyAdmin itself is ready for this change, but your ability to use it depends on your PHP version).

您基本上有两个选择:

  1. 将您的PHP升级到7.4或更高版本.
  2. 将用户的身份验证类型更改为较早的mysql_native_password.您可以通过编辑用户来做到这一点(从phpMyAdmin的用户帐户"标签中,编辑用户,然后从下拉菜单中更改身份验证方法).
  1. Upgrade your PHP to 7.4 or newer.
  2. Change the authentication type on your user to the older mysql_native_password. You can do that by editing the user (from the User accounts tab in phpMyAdmin, edit the user, then change the authentication method from the dropdown).

这篇关于在phpMyAdmin中使用SHA256设置用户密码后,访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆