top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to encrypt a mysql Database password?

+2 votes
213 views

In my web application I need to encrypt the database password and and that should be stored in the properties file?

posted Mar 17, 2014 by Shiva Kumar H

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
I missed that the question was tagged as Java, in java also you can generate MD5 or SHA1. Following two links should help.
http://stackoverflow.com/questions/16323701/hash-a-password-with-sha1-in-java

Algo is same as previous.
http://stackoverflow.com/questions/415953/generate-md5-hash-in-java
sha1 or md5 are complex algo but if you are trying something for the experiment then you can just replace a character "a" with "a+5", "b" with "b+5". If you want the standard algo the above link should be very handy and should work without any issue.

1 Answer

0 votes

Passwords are stored in the form of single pass so that even the admin can not know the password. Check http://in2.php.net/sha1 (assuming you are using the PHP for the web-application) for generating the sha1 for the passwd.

I am providing the high level steps to store and login using the passwd.
1. Whenever user register you get the uname and passwd.
2. You store the uname and sha1(passwd) in the db.
3. whenever user login he/she will provide the uname and passwd, you check the sha1(passwd) with the stored one for the enetered user if both are same then you proceed else not.

Please let us know if you have any further query.

answer Mar 17, 2014 by Salil Agrawal
Similar Questions
0 votes

I am having trouble to transfer email user account which is saved in MySQL to another server. Here is the detail:

I have an old email server which using MySQL to store user account information. The password field uses MySQL ENCRYPT function to save the users password. So if I want change the user's password I can do:
UPDATE mail.users SET password = ENCRYPT( '12345' ) WHERE CONVERT( users.email USING utf8 ) = 'g@veecall.com' LIMIT 1 ;

Then the new password "12345" saved in the table as string of "2I6JOeg.JukJ."

Now I build a new server using iRedMail. When I try to transfer user account I have trouble to transfer the password field. Because the iRadMail/dovecot is using MD5-CRAM to encrypt the password then save it
in the MySQL. All the password string is started with "$1$".

So, is there a way to make the MySQL encrypted password string "2I6JOeg.JukJ." convert to MD5 hash "$1$................."?

+1 vote

In my web application I have a requirement database password should be stored in properties fie and that should be encrypted and during login that it needs to check the username password and database password database password should be decrypt during login and and encrypt during log out.

+1 vote

I have some problem
I have store the data in the database without encrypt but i am view the data encrypt method after 1 day and doesn't know the details.

I am using php and mysql, Could the experts please comment on this, and offer some advice?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...