Reputation: 147
I have a MySQL database with a table that contains usernames and passwords. I want a bash script or MySQL statement that will randomise all the passwords.
I can reset one password with something like
select md5(rand()) as password;
I can loop through with a bash read while loop. Just need help putting it all together.
Yews I know there should not be passwords stored in the clear, it's a legacy system we are moving people away from.
Upvotes: 0
Views: 100
Reputation: 15802
I think you should be able to just CONCAT
the current password into the md5, to keep them all unique.
UPDATE passwords SET password = md5(CONCAT(RAND(), password))
Upvotes: 0