Solve mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)

Solve mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)

1. Problem

Sometimes when we log in to Mysql and enter the password, this situation occurs

mysql -u root -p

Enter Password > 'Password'

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

Or: Error: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

2. Solution

Modify the my.in/my.cnf configuration file

Enter the mysql installation directory

Edit my.ini

Add skip-grant-tables under [mysqld] and save the file.

Open a command line as an administrator

①Restart mysql:

1. net stop mysql 2. net start mysql

②Enter mysql, log in mysql -u root -p
No need to enter a password, just press Enter (if Enter Password appears, just press Enter to log in successfully)

③Enter use mysql to change the root password:
update user set authentication_string=password('new password') where user='root';
flush privileges;

④Exit:

quit;

⑤Restart mysql again:

1. net stop mysql 2. net start mysql

⑥Whether the test is successful means whether the login is successful.
mysql -u root -p

Enter Password>'New Password'

There will be no mistakes, you can log in! ! !

(Another situation is that you entered the wrong password. If this is the first time you log in after initialization, it is very likely that the password is wrong. You should carefully check the password after initialization. It may be due to spaces, decimal points and other symbols.)

The above is the detailed content of solving mysql: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES). For more information about ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES), please pay attention to other related articles on 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
  • ERROR 1045 (28000): Access denied for user ''''root''''@''''localhost''' (using password: YES) Practical solution
  • 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

<<:  Tips on making web pages for mobile phones

>>:  CSS stacking and z-index example code

Recommend

Vue realizes the product magnifying glass effect

This article example shares the specific code of ...

Website construction experience summary

<br />What principles should be followed to ...

MySQL 8.0.15 installation tutorial for Windows 64-bit

First go to the official website to download and ...

js implements the pop-up login box by clicking the pop-up window

This article shares the specific code of js to re...

MySQL replication table details and example code

MySQL replication table detailed explanation If w...

Linux file system operation implementation

This reading note mainly records the operations r...

How to use VirtualBox to simulate a Linux cluster

1. Set up HOST on the host Macbook The previous d...

Several ways to center a box in Web development

1. Record several methods of centering the box: 1...

Detailed explanation of how Angular handles unexpected exception errors

Written in front No matter how well the code is w...

Common pitfalls of using React Hooks

React Hooks is a new feature introduced in React ...

MySQL 8.0 installation tutorial under Linux

This article introduces how to install MySQL 8.0 ...

How to turn a jar package into a docker container

How to turn a jar package into a docker container...