How I will make every password in my user table encrypted(md5()) except one particular row using a single query?
In other words, the server checks hash values during authentication when a client first attempts to connect. The server generates hash values if a connected client invokes the PASSWORD () function or uses a password-generating statement to set or change a password. Password hashing methods in MySQL have the history described following.
The MySQL PASSWORD function is used for the generation of a hashed password using a plain-text password string It uses hashing techniques to generate the hashed password. This function is carried out by the authentication system.
MySQL server uses the PASSWORD function to encrypt MySQL passwords for storage in the Password column of the user grant table. The value returned by the PASSWORD function is a hashed string, or NULL if the argument was NULL.
The password_hash () function creates a secure hash of your password. This is how you can use it: $password = 'my secret password'; $hash = password_hash($password, PASSWORD_DEFAULT); The result hash from password_hash () is secure because:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With