Encryption and Compression Functions
956
This is the “RSA Data Security, Inc. MD5 Message-Digest Algorithm.”
See the note regarding the MD5 algorithm at the beginning this section.
•
OLD_PASSWORD(str)
[956]
OLD_PASSWORD()
[956]
was added when the implementation of
PASSWORD()
[956]
was
changed in MySQL 4.1 to improve security.
OLD_PASSWORD()
[956]
returns the value of the
pre-4.1 implementation of
PASSWORD()
[956]
as a binary string, and is intended to permit you
to reset passwords for any pre-4.1 clients that need to connect to your version 5.0 MySQL server
without locking them out. See
Section 6.1.2.4, “Password Hashing in MySQL”
.
•
PASSWORD(str)
[956]
Calculates and returns a hashed password string from the plaintext password
str
and returns a
binary string, or
NULL
if the argument is
NULL
. This function is the SQL interface to the algorithm
used by the server to encrypt MySQL passwords for storage in the
mysql.user
grant table.
The password hashing method used by
PASSWORD()
[956]
depends on the value of the
old_passwords
[480]
system variable:
mysql>
SET old_passwords = 0;
mysql>
SELECT PASSWORD('mypass');
+-------------------------------------------+
| PASSWORD('mypass') |
+-------------------------------------------+
| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
+-------------------------------------------+
mysql>
SET old_passwords = 1;
mysql>
SELECT PASSWORD('mypass');
+--------------------+
| PASSWORD('mypass') |
+--------------------+
| 6f8c114b58f2ce9e |
+--------------------+
If
old_passwords=1
,
PASSWORD('str')
[956]
returns the same value as
OLD_PASSWORD('str')
[956]
.
For descriptions of the permitted values of
old_passwords
[480]
, see
Section 5.1.4, “Server
System Variables”
.
Encryption performed by
PASSWORD()
[956]
is one-way (not reversible). It is not the same type of
encryption as used for Unix passwords; for that, use
ENCRYPT()
[955]
.
Note
The
PASSWORD()
[956]
function is used by the authentication system
in MySQL Server; you should not use it in your own applications. For that
purpose, consider
MD5()
[955]
or
SHA1()
[956]
instead. Also see
RFC
2195, section 2 (Challenge-Response Authentication Mechanism (CRAM))
,
for more information about handling passwords and authentication securely in
your applications.
Important
Statements that invoke
PASSWORD()
[956]
may be recorded in server logs
or in a history file such as
~/.mysql_history
, which means that cleartext
passwords may be read by anyone having read access to that information.
See
Section 6.1.2, “Keeping Passwords Secure”
.
•
SHA1(str)
[956]
,
SHA(str)
[956]
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...