Working With the Encryption Password Function in MySQL

In MySQL server we have to explain the password function() and how it will recover a password in its string form. The password function is mainly 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. Password also stores as a record on server.

In the following figures we have a database table "employees" and use it with some query with showing result 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 it 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;

img 4.gif

OLD_PASSWORD(str)

It returns the value of the old password and implementation of the password() as a binary string.

mysql-> select old_password("text");

OLD_PASSWORD.gif

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.gif

Storing a passwords

With the use of the SHA1, it helps to keep the password more protected than storing them as plain text.

sha1.gif

Resources

Here are some useful resources:

Up Next
    Ebook Download
    View all
    Learn
    View all