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

An article to understand the execution process of MySQL query statements

Preface We need to retrieve certain data that mee...

Simple example of adding and removing HTML nodes

Simple example of adding and removing HTML nodes ...

Vue Page Stack Manager Details

Table of contents 2. Tried methods 2.1 keep-alive...

Example of javascript bubble sort

Table of contents 1. What is Bubble Sort 2. Give ...

HTML Language Encyclopedia

123WORDPRESS.COM--HTML超文本标记语言速查手册<!-- --> !D...

Use Firebug tool to debug the page on iPad

How to debug a page on iPad? When using iOS 5, you...

Detailed explanation of this pointing problem in JavaScript function

this keyword Which object calls the function, and...

A Different Kind of "Cancel" Button

The “Cancel” button is not part of the necessary ...

Vue implements login type switching

This article example shares the specific code of ...

Usage of mysql timestamp

Preface: Timestamp fields are often used in MySQL...

How to obtain and use time in Linux system

There are two types of Linux system time. (1) Cal...

Vue realizes click flip effect

Use vue to simply implement a click flip effect f...

Detailed example of reading speed of js objects

1. Accessing literals and local variables is the ...

jQuery+Ajax to achieve simple paging effect

This article shares the specific code of jquery+A...