SQL Update of MD5 Passwords SQL Update of MD5 Passwords sql sql

SQL Update of MD5 Passwords


Correct syntax would be this:

UPDATE UsersSET password = MD5('tony123')WHERE user_id = 55;

Or, if you were storing password in plain text and you want to convert them to hashes, do this:

UPDATE UsersSET password = MD5(password);


this will work after you add db connection strings to your php file:

<?php$password = 'tony123';$passwordmd5 = md5($password);$q = mysql_query("UPDATE `Users` SET password = '$passwordmd5' WHERE user_id = 55");?>

php/mysql connection ref: http://php.net/manual/en/function.mysql-connect.php


i have stored password as a text into db and when i converted it to MD5 password i used this query,

UPDATE tablename SET columname = MD5(columname);

in above query you can also use any method instead of MD5 by just replacing MD5.