fos
11-23-2007, 10:44 PM
While working on a mysql project, I started receiving an error warning from the mysql server. It was truncating the data generated by the password() function to encrypt a user's password. In addition, the function was not producing a usable encrypted password.
I did a search on the mysql 5 manual and found the following statement:
"The PASSWORD() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_password) function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_md5) or SHA1() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_sha1) instead."
Experimentation proved that the sha() function worked well producing expected results without generating an error. Using this method, you must set define the variable to char(40) in order to hold the encrypted data.
This info might save a fair amount of research time if you need to use passwords in an secure mysql application.
fos
I did a search on the mysql 5 manual and found the following statement:
"The PASSWORD() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_password) function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_md5) or SHA1() (http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_sha1) instead."
Experimentation proved that the sha() function worked well producing expected results without generating an error. Using this method, you must set define the variable to char(40) in order to hold the encrypted data.
This info might save a fair amount of research time if you need to use passwords in an secure mysql application.
fos