ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: YES) Practical solution

ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: YES) Practical solution

There was no problem connecting to the database yesterday, but today this error was reported when connecting to the database. I searched a lot of methods on the Internet and found one method that solved my problem. My environment is Linux

Steps: First, you need to skip password authentication. Find the /etc/my.cnf file in the Linux environment, find mysqld in the file, and add the skip-grant-tables statement under mysqld to avoid password verification. Then restart mysql, /etc/init.d/mysqld restart, and change the password.

as follows,

mysql> use mysql;
mysql> update user set password=password("your new password") where user="root";
mysql> flush privileges;
mysql> quit

Then restart MySQL, use the same statement as above, the problem is solved. If you want to modify the username at the same time, you can use the following statement:

mysql> use mysql;
mysql> update user set password=password("your new password"), user="(user name to be modified)" where user="root";
mysql> flush privileges;
mysql> quit

Summarize

The above is all the content of this article about MySQL error solutions. I hope it will be helpful to everyone. Interested friends can continue to refer to this site: Brief analysis of the MySQL character set causing database recovery errors, analysis of MySQL table sorting rules different error problems, etc. If you have any questions, you can leave a message at any time, and the editor will reply to you in time.

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
  • How to solve the error "ERROR 1045 (28000)" when logging in to MySQL
  • 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
  • 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)
  • MYSQL ERROR 1045 (28000): Access denied for user (using password: YES) solution
  • Solve mysql: ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: NO/YES)

<<:  jQuery plugin to implement floating menu

>>:  Explanation of several ways to run Tomcat under Linux

Recommend

JavaScript drag time drag case detailed explanation

Table of contents DragEvent Interface DataTransfe...

Pitfall notes of vuex and pinia in vue3

Table of contents introduce Installation and Usag...

A brief discussion on HTML doctype and encoding

DOCTYPE Doctype is used to tell the browser which...

Detailed explanation of various types of image formats such as JPG, GIF and PNG

Everyone knows that images on web pages are genera...

XHTML Web Page Tutorial

This article is mainly to let beginners understan...

Detailed explanation of the process of modifying Nginx files in centos7 docker

1. Install nginx in docker: It is very simple to ...

Implementation of IP address configuration in Centos7.5

1. Before configuring the IP address, first use i...

Index in MySQL

Preface Let's get straight to the point. The ...

HTML markup language - table tag

Click here to return to the 123WORDPRESS.COM HTML ...

How to implement a multi-terminal bridging platform based on websocket in JS

Table of contents 1. What to debug 2. Features of...

Linux Check the installation location of the software simple method

1. Check the software installation path: There is...

Detailed steps to build the TypeScript environment and deploy it to VSCode

Table of contents TypeScript environment construc...

How to connect to virtual machine MySQL using VScode in window environment

1. Virtual Machine Side 1. Find the mysql configu...

A method of making carousel images with CSS3

Slideshows are often seen on web pages. They have...