MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 11th, 2012, 05:23 AM
gw1500se gw1500se is online now
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,880 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 2 Days 10 h 30 m 53 sec
Reputation Power: 581
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.

Reply With Quote
  #2  
Old October 12th, 2012, 06:31 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,939 E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)E-Oreo User rank is General 91st Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 9 h 13 m 20 sec
Reputation Power: 7053
Per the MySQL manual, you shouldn't use ENCRYPT or PASSWORD for storing application passwords in a MySQL database; the reason behind this is the fact that MySQL may log them into plaintext log files.

ENCRYPT will substitute a random salt if you don't pass one in the second argument, so the fact that it returns no results isn't surprising; however, I am surprised that it would appear the same in the result.

Some modes for PASSWORD will use a random salt too, I'm guessing that's probably what's happening here. I'm not too familiar with how it works and the manual is light on details since it is really only intended to be used for storing MySQL user account passwords. There is a system variable called "old_passwords" that you can set to change the behavior of PASSWORD.

Quote:
The current version of MySQL is 14.14

MySQL is only up to version 5.6
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Password and encrypt problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap