Current location: Hot Scripts Forums » Programming Languages » PHP » Mysql and MD5


Mysql and MD5

Reply
  #1 (permalink)  
Old 04-23-04, 11:25 AM
nicpon nicpon is offline
Wannabe Coder
 
Join Date: Apr 2004
Location: Moving
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Mysql and MD5

Hello,
I have question about MD5. I have some passwords stored in mysql database and my boss wants me to change them hehe.The thing is that it has to be done fast and there no website application to change it.So my question is there a way to change the vaule of the password field in mysql database coded in MD5?

Michael
Reply With Quote
  #2 (permalink)  
Old 04-23-04, 11:43 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Code:
UPDATE table_1 SET password_field=MD5(password_field);
excute this SQL query using phpMyAdmin for example but of course you have to change table_1 to your table name and password_field to your password field name
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 04-23-04, 04:10 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
NOTE: this query will encrypt ALL the records which are under the colmun password_field in your database with the MD5() alogarithm ..
just to make sure that you know what you are doing ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #4 (permalink)  
Old 04-23-04, 05:56 PM
nicpon nicpon is offline
Wannabe Coder
 
Join Date: Apr 2004
Location: Moving
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by NeverMind
Code:
UPDATE table_1 SET password_field=MD5(password_field);
excute this SQL query using phpMyAdmin for example but of course you have to change table_1 to your table name and password_field to your password field name
In this piece of query MD5(password_field) what is password_field?Is it a password field name or the password i have to put in b\c if i have two password field names it doesnt make sens ??

Michael
Reply With Quote
  #5 (permalink)  
Old 04-23-04, 08:58 PM
nicpon nicpon is offline
Wannabe Coder
 
Join Date: Apr 2004
Location: Moving
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by nicpon
In this piece of query MD5(password_field) what is password_field?Is it a password field name or the password i have to put in b\c if i have two password field names it doesnt make sens ??

Michael
Ok i thought about what you have written before and it make sens.What if i would like to change only certain rows and not all of them or what will happen to those that are already in MD5?Is the query going to change them again??
Michael
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 10:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.