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

Solution to inconsistent display of cursor size in input box

The cursor size in the input box is inconsistent T...

How to implement nginx smooth restart

1. Background During the server development proce...

Make your website run fast

Does performance really matter? Performance is im...

How to deploy nginx with Docker and modify the configuration file

Deploy nginx with docker, it's so simple Just...

Why are the pictures on mobile web apps not clear and very blurry?

Why? The simplest way to put it is that pixels are...

Detailed example of inserting custom HTML records in Quill editor

It is already 2020. Hungry humans are no longer s...

Tutorial on installing AutoFs mount service under Linux

Whether it is Samba service or NFS service, the m...

How to implement paging query in MySQL

SQL paging query:background In the company's ...

How to implement controllable dotted line with CSS

Preface Using css to generate dotted lines is a p...

Native JavaScript to implement random roll call table

This article example shares the specific code of ...

Detailed explanation of pid and socket in MySQL

Table of contents 1. Introduction to pid-file 2.S...

Alibaba Cloud ESC Server Docker Deployment of Single Node Mysql

1. Download the accelerated version of msyql dock...

Nginx improves access speed based on gzip compression

1. Why does nginx use gzip? 1. The role of compre...

Full steps to create a high-performance index in MySQL

Table of contents 1. Index Basics 1. Types of Ind...