How to hash passwords in MySQL?

前端 未结 6 805
死守一世寂寞
死守一世寂寞 2020-12-25 08:18

How I will make every password in my user table encrypted(md5()) except one particular row using a single query?

6条回答
  •  心在旅途
    2020-12-25 09:11

    UPDATE table SET Password = MD5(Password)
    

    I will say though that MD5 isn't a very good level of encryption and you should consider something stronger such as ENCRYPT with a custom salt. Read about it here

    EDIT: Looks like the original question changed. Here's the altered query to accomodate

    UPDATE table SET Password = MD5(Password) WHERE ID!=[specified index]
    

    EDIT: Worth noting

    MD5 Encryption Hacked

提交回复
热议问题