mysql使用什么样的哈希?

2022-01-22 00:00:00 hash passwords mysql

我正在编写自己的代码,类似于 phpMyAdmin.但我需要用户能够使用 mysql 数据库中的用户名和密码登录.我需要知道 mysql 数据库使用哪种散列来存储每个用户的密码.我检查了 dev.mysql.com 的答案,但找不到任何东西,除了以 * 开头的较新的 41 字节哈希.

I'm writing my own code similar to phpMyAdmin. But I'll need the user to be able to sign on using their username and password from the mysql database. I need to know what kind of hash the mysql database uses to store each users password. I checked dev.mysql.com for answers but couldnt find anything, other than its the newer 41 byte hash beginning with an *.

推荐答案

我不认为你将能够解密存储在 MySQL 表中的密码,使用存储在 mysql 中的密码也没有用.<代码>用户表.

I don't think you will be able to decrypt password stoed in MySQL table and it's of no use using password which is stored in mysql.user table.

您应该使用在您的应用程序中创建 User 时设置的密码,如果您丢失了用户密码,那么您可以使用 mysqladmin 重置它

You should be using password that is being set when User is created in your application, If you have lost password of users then you can reset it using mysqladmin

设置 'user-name-here'@'hostname-name-here' 的密码 = PASSWORD('new-password-here');

SET PASSWORD FOR 'user-name-here'@'hostname-name-here' = PASSWORD('new-password-here');

相关文章