V
V
viktorleg2016-12-31 18:24:26
MySQL
viktorleg, 2016-12-31 18:24:26

How to transfer passwords from old MySQL database to new MySQL database?

Hi everybody!
Tell me how to transfer user passwords from the old MySQL database to the new MySQL database? The problem is that in the old database the password consists of varchar(45) and no salt, while in the new database the password consists of varchar(32) + salt varchar(3).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergeyfk, 2016-12-31
@sergeyfk

Transfer the old base completely. Then add a "salt" field. Then with PHP, Python, etc. or even manually "go through" each field and check if the password is more than 32 characters, then delete everything that comes after 32 characters, if less, then do nothing.

S
SagePtr, 2016-12-31
@SagePtr

If there is no way to get the second hash from the first hash, then there is no way to transfer it. Is it possible to make a field like old_password and store the old password format there, and when logging in, check if this user has an old password and it matches, then generate a new hash based on it. As a result, over time, user hashes will be recalculated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question