Introduction
In the MySQL server, we have to explain the password function() and how it will recover a password in its string form. The password function ismainly used for authentication. The password function encrypts the string into a binary form. Recover a password in text form and set the old password, and select it in the text form. The password function returns it in string form and restores a password in plain text. The password also stores as a record on the server.
In the following figures, we have a database table "employees" and use it with some query with showing results such as follows.
mysql-> select * from myworld;
![img 1.gif]()
Using the password function to ENCRYPT first name
Here we have to encrypt the password function on the particular column on a table with the select statement such as.
mysql-> select password(first_name) from myworld.
![img 2.gif]()
To display which accounts exist in the MySQL
Here we have to show the user table and check that their passwords are empty by using the following statement.
mysql-> select user,host,password from mysql.user;
![img 3.gif]()
Using old password to ENCRYPT the first name
By the use of this select statement, show the old password on a particular column on a table.
mysql-> select old_password(last_name) from myworld;
![encryptoldpassword]()
OLD_PASSWORD(str)
It returns the value of the old password and the implementation of the password() as a binary string.
mysql-> select old_password("text");
![Oldpassword]()
Calculates and returns a password
The password (string) calculates and returns a password string from the plain text password string, and it returns a binary string.
mysql-> select password('asingh');
![returns a password]()
With the use of SHA1, it helps to keep the password more protected than storing them as plain text.
![sha1.]()
Resources
Here are some useful resources: