©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The PASSWORD SQL Function in MySQL and MariaDB - Generate password hash

PASSWORDSyntax:PASSWORD(String)
Return value:CHAR
Function type:Encryption & Compression
Function Description

The PASSWORD() function returns a hashed password string computed from "String".

This function is the SQL interface to encrypt passwords for storage in the authorization table.

The return value is a string in the connection's character set.

Numeric values ​​are interpreted as a character string.

If "String" contains no characters, the function returns an empty string.

If the value of "String" is NULL, the PASSWORD() function returns NULL.

SQL Examples for the PASSWORD function

 1
 2
 3
 4
 5
 6
 7
 8
 9

SELECT password('Test');
SELECT password('New Password');
SELECT password(54321);

SELECT password(' ');
SELECT password('');
SELECT password(null);

password('Test')
varchar(41) BINARY
*AF31C6CBDECD88726D0A9B3798C71EF41F1624D5
password('New Password')
varchar(41) BINARY
*12B8D04CBF632C1876A0526B53668AE6DB63B08B
password(54321)
varchar(41) BINARY
*273162E1A674997C0F6481B0BB677E62B5065A00
password(' ')
varchar(41) BINARY
*1A256E4E2FE95B8BF7349C168991EA8035D1359B
password('')
varchar(41) BINARY
 
password(null)
varchar(41) BINARY
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the PASSWORD() function in MySQL and MariaDB databases

In MySQL and MariaDB the PASSWORD() function is used to hash a password using the native password hashing algorithm of the database by taking a string (password) as input and returning the hashed value as an encoded string.

The native password hashing algorithm used by MySQL and MariaDB may vary depending on the version and configuration of the database, but there should be a better one provide security than the older password hashing algorithms such as the OLD_PASSWORD() or MD5() function, as these algorithms provide stronger protection against brute force attacks and password cracking. The function is rather unsuitable for general hashing purposes.
OCTET_LENGTHOLD_PASSWORDORDPASSWORDPIPOSITIONPOW

Further MySQL und MariaDB SQL Encryption & Compression

AES_DECRYPTAES_DECRYPT(String, Key)
More about AES_DECRYPT Function

AES_ENCRYPTAES_ENCRYPT(String, Key)
More about AES_ENCRYPT Function

COMPRESSCOMPRESS(String)
More about COMPRESS Function

DECODEDECODE(Binary string, Password)
More about DECODE Function

DES_DECRYPTDES_DECRYPT(Binary string [, Key])
More about DES_DECRYPT Function

DES_ENCRYPTDES_ENCRYPT(String [, Key])
More about DES_ENCRYPT Function

ENCODEENCODE(String, Password)
More about ENCODE Function

ENCRYPTENCRYPT(String [, Salt])
More about ENCRYPT Function

FROM_BASE64FROM_BASE64(String)
More about FROM_BASE64 Function

MD5MD5(String)
More about MD5 Function

OLD_PASSWORDOLD_PASSWORD(String)
More about OLD_PASSWORD Function

RANDOM_BYTESRANDOM_BYTES(Length)
More about RANDOM_BYTES Function

SHASHA(String)
More about SHA Function

SHA1SHA1(String)
More about SHA1 Function

SHA2SHA2(String, Length)
More about SHA2 Function

TO_BASE64TO_BASE64(String)
More about TO_BASE64 Function

UNCOMPRESSUNCOMPRESS(Binary string)
More about UNCOMPRESS Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the PASSWORD SQL function: mysql.com and mariadb.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer