Solution to ERROR 1054 (42S22) when changing password in MySQL 5.7

Solution to ERROR 1054 (42S22) when changing password in MySQL 5.7

I have newly installed MySQL 5.7. When I log in, I get a message saying that the password is wrong. I did not change the password during installation. Later, I changed the password by logging in without a password. When I enter update mysql.user set password=password('root') where user='root', I get a message saying ERROR 1054 (42S22): Unknown column 'password' in 'field list'. It turns out that there is no password field in the MySQL database. The password field has been changed to authentication_string.

So change the statement to update mysql.user set authentication_string=password('root') where user='root';

My system version is as follows:

The complete procedure for changing the MySQL password is as follows:

1. vim /etc/my.cnf add skip-grant-tables

2. Restart MySQL, /etc/init.d/mysqld restart

3. Enter mysql in the terminal to log in to the MySQL database directly, and then use mysql

4. update mysql.user set authentication_string=password('root') where user='root';

To change the password in MySQL 5.7, you should use the command ALTER USER 'root'@'localhost'IDENTIFIED BY '********', in which the password naming rule has changed.

The password set for MySQL must contain at least one uppercase letter, one lowercase letter, one special symbol, and one number.
Password must be at least 8 characters long

5. Edit the my.cnf file and delete the skip-grant-tables line, then restart MySQL, /etc/init.d/mysqld restart, otherwise MySQL can still log in without a password

6.mysql -u root -p

Then enter the password to log in to the MySQL database

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Solution to mysql ERROR 1045 (28000) problem
  • How to solve the mysql ERROR 1045 (28000)-- Access denied for user problem
  • Solution to the Mysql ERROR 1045 (28000): Access denied for user root@localhost problem in Ubuntu system
  • Solve the problem of ERROR 1045 (28000): Access denied for user ''root''@''localhost'' when logging in after installing MySQL 5.7.17 on Ubuntu 16.04
  • After installing MySQL, the root account prompt appears when logging in. mysql ERROR 1045 (28000): Access denied for use solution
  • How to solve the problem of error Nr.1045 when installing mysql
  • MySQL ERROR 1045 (28000) error solution
  • MySQL ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: NO) Causes and solutions
  • MySQL login error prompt: Solution to ERROR 1045 (28000)
  • How to solve the ERROR 1045 problem when logging into mysql
  • How to solve Error 1045 access denied when installing MYSQL on winxp
  • MYSQL ERROR 1045 (28000): Access denied for user (using password: YES) solution

<<:  How to get the current time using time(NULL) function and localtime() in Linux

>>:  Vue Router loads different components according to background data

Recommend

Reasons and solutions for MySQL selecting the wrong index

In MySQL, you can specify multiple indexes for a ...

Native JS implements a very good-looking counter

Today I will share with you a good-looking counte...

Detailed explanation of MySQL sql_mode query and setting

1. Execute SQL to view select @@session.sql_mode;...

Detailed explanation of the pitfalls of mixing MySQL order by and limit

In MySQL, we often use order by for sorting and l...

mysql 5.7.5 m15 winx64.zip installation tutorial

How to install and configure mysql-5.7.5-m15-winx...

Quickly solve the problem of slow Tomcat startup, super simple

Today I helped a classmate solve a problem - Tomc...

Vue imitates ElementUI's form example code

Implementation requirements The form imitating El...

Basic usage examples of Vue named slots

Preface Named slots are bound to elements using t...

uniapp project optimization methods and suggestions

Table of contents 1. Encapsulate complex page dat...

Detailed steps to use Redis in Docker

1. Introduction This article will show you how to...

Detailed explanation of the use of MySQL Online DDL

Table of contents text LOCK parameter ALGORITHM p...

HTML end tag issue and w3c standard

According to the principles of W3C, each start tag...

Solution to 2059 error when connecting Navicat to MySQL

Recently, when I was learning Django, I needed to...

MySQL 8.0.15 winx64 installation and configuration method graphic tutorial

This article shares the installation and configur...