Home > Database > Mysql Tutorial > Why is there no `password` column in the MySQL 5.7 `user` table?

Why is there no `password` column in the MySQL 5.7 `user` table?

Mary-Kate Olsen
Release: 2024-11-28 21:48:11
Original
896 people have browsed it

Why is there no `password` column in the MySQL 5.7 `user` table?

MySQL user DB Does Not Have Password Columns in MySQL 5.7

While attempting to modify the root password in MySQL, you may encounter an error message stating that the user table's password column is unknown. This anomaly, however, is not a bug.

Understanding the Change in MySQL 5.7

In MySQL 5.7, the password field in the user table has been renamed to authentication_string. This change reflects a shift in password management to improve security.

Verification and Solution

To confirm this and troubleshoot the issue:

  1. Select the mysql database:

    mysql> use mysql;
    Copy after login
  2. Show the tables:

    mysql> show tables;
    Copy after login
  3. Describe the user table's structure:

    mysql> describe user;
    Copy after login
  4. You will notice the absence of a password field but the presence of an authentication_string field.

To modify the password, simply execute the following command, replacing 1111 with your desired password:

update user set authentication_string=password('1111') where user='root';
Copy after login

Additional Changes in MySQL 5.7

Beyond the password column change, MySQL 5.7 introduced other significant enhancements. For a comprehensive overview of these changes, refer to the documentation: [What's New in MySQL 5.7](https://dev.mysql.com/doc/refman/5.7/en/news-5-7.html)

The above is the detailed content of Why is there no `password` column in the MySQL 5.7 `user` table?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template