Mysql ENCODE
From w3cyberlearnings
Contents |
MySQL ENCODE Function
Encrypt string by using the pass_str, and this function is very low level encryption that does not use specific algorithm. Use DECODE() function to decode encrypt string created by ENCODE().
Syntax ENCODE
- str: string to encrypt
- pass_str: password string.
ENCODE(str, pass_str);
Example 1
mysql> SELECT ENCODE('password123','sec2021'); +---------------------------------+ | ENCODE('password123','sec2021') | +---------------------------------+ | Qj�lM�4���m | +---------------------------------+ 1 row in set (0.00
Example 2
mysql> INSERT INTO userpassword(username, password) -> VALUES('Alex',ENCODE('password123','topSecret')); Query OK, 1 row affected (0.00 sec) mysql> SELECT * FROM userpassword; +----+----------+-------------+ | id | username | password | +----+----------+-------------+ | 1 | Alex | �ᅯ�std�a | +----+----------+-------------+ 1 row in set (0.00