October 11th, 2012, 05:23 AM
Password and encrypt problem
I have recently upgraded my Linux from Mandriva to CENTOS and have encountered a problem with 'password' and 'encrypt' which worked previously. The current version of MySQL is 14.14. I have a table that includes both an 'encrypt'ed and 'password' password. So I do the following:
UPDATE mytable SET pwd=ENCRYPT('somepw'),pwdp=PASSWORD('somepw') WHERE username='myuser';
The result is that 1 row was successfully updated. Next I do the following:
SELECT username FROM mytable WHERE pwd=ENCRYPT('somepw');
Result is 0 rows returned. I also tried:
SELECT username FROM mytable WHERE pwdp=PASSWORD('somepw');
Again the result is 0 rows returned.
Now comes the interesting part. If I rerun the same update then look at the resultant strings in the table, 'pwd' is the same each time while 'pwdp' is different each time. First it does not make sense to me that 'pwdp' would change but explains why no rows were returned. Could that be some config problem? Second, while 'pwd' is consistent as expected, it makes no sense that it is not found in the table. Can someone help me make sense of all this and fix it? TIA.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
Last edited by gw1500se : October 11th, 2012 at 05:27 AM.