ERROR 1045 of 28000: Access denied for user ''root'' @ ''localhost'' of using password: YES Utility Solution

  • 2021-09-16 08:22:22
  • OfStack

Yesterday, there was no problem with the database, but today, I reported this error when I connected to the database. I also searched a lot of methods on the Internet, and there was a method to solve my problem. My environment is Linux

Steps: First, you need to skip password authentication, find the/etc/my. cnf file in Linux environment, find mysqld in the file, and add skip-grant-tables statement under mysqld, so as to avoid password authentication, and then restart mysql,/etc/init. d/mysqld restart to modify 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, the statement is the same as above, the problem is solved, if you want to modify the user name 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 modify )" where user="root";
mysql> flush privileges;
mysql> quit

Summarize

The above is the whole content of MySQL error reporting solution in this article, hoping to be helpful to everyone. Interested friends can continue to refer to this site: a brief analysis of mysql character set lead to recovery database error problem, MySQL table collation rules different error problem analysis, etc. If there is a problem, you can leave a message at any time, this site will reply to everyone in time.


Related articles: