Which Table Does Mysql Store Password

How To Articles

In regards to managing user accounts and guaranteeing their protection, MySQL, the renowned open-source database management system, places a strong emphasis on securely storing passwords. In this article, I will delve into MySQL’s method of storing passwords and examine the specific table used for this purpose.

As a MySQL expert, I understand the importance of password security for any system that deals with sensitive user information. MySQL uses a hashing technique to store passwords securely. Instead of storing the actual passwords, MySQL stores the hash values generated from the passwords using a strong hashing algorithm.

The table in which MySQL stores password information is called the ‘mysql.user’ table. This table holds the user account details, including usernames, encrypted passwords, and various privileges associated with each user.

Within the ‘mysql.user’ table, the password field is named ‘authentication_string’. It’s important to note that in older versions of MySQL, the password field was named ‘password’. However, starting from MySQL 5.7.6, the ‘authentication_string’ field was introduced to accommodate stronger password hashing techniques.

Now, let’s talk about the password hashing algorithm used by MySQL. In recent versions, MySQL by default uses the SHA-256 algorithm to hash passwords. This algorithm generates a 64-character hexadecimal string as the hash value for each password. The SHA-256 algorithm is considered secure and provides a good balance between security and performance.

It’s worth mentioning that MySQL also supports other password hashing algorithms, such as SHA-1 and MD5, for compatibility with older systems. However, it is highly recommended to use the SHA-256 algorithm or higher for better security.

When a user attempts to log in to MySQL, the entered password is hashed using the same algorithm and compared to the stored hash value in the ‘authentication_string’ field. If the hashes match, the user is granted access to the system.

As a database administrator, it’s crucial to take additional measures to enhance the security of password storage in MySQL. Some best practices include implementing a strong password policy, enforcing regular password rotations, and enabling two-factor authentication for user accounts. These measures help to further protect sensitive data and prevent unauthorized access.


In conclusion, MySQL securely stores passwords by utilizing a strong hashing algorithm and storing the hash values rather than the actual passwords. The ‘mysql.user’ table is where the password information is stored, with the ‘authentication_string’ field holding the hashed password values.

By understanding the password storage mechanism used by MySQL, you can ensure the security of your user accounts and protect sensitive data within your MySQL databases. Remember to always follow best practices for password management and regularly update your MySQL version to benefit from the latest security enhancements.