How to solve the mysql ERROR 1045 (28000)-- Access denied for user problem

How to solve the mysql ERROR 1045 (28000)-- Access denied for user problem

Problem description (the following discussion is limited to Windows environment):

 D:\develop\ide\mysql\mysql5.5\bin>mysql -u root -p
 Enter password:
 ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: NO)

Step 1: Edit the my.ini configuration file in the MySQL installation directory and add the following under the [mysqld] entry:

skip-grant-tables

As shown below:

After saving and exiting

Step 2: Restart MySQL

The restart steps are as follows:

1. Enter the Task Manager and check whether mysqld.exe is running. If it is running, kill it;

2. Find the bin folder in the MySQL installation directory, then find the mysqld.exe file, double-click it to run, then enter the task manager again to check whether mysqld.exe is running. After confirming that it is running, double-click the mysql.exe file.

Step 3: Reset the password of the local MySQL database

In cmd, go to the D:\develop\ide\mysql\mysql5.5\bin directory and enter mysql -u root -p. You can log in without a password. When password: appears, press Enter to enter. ERROR 1045 (28000) will not appear, but many operations will be restricted because you do not have permission. So you need to follow the following process (the red part is the input part, and the orange part is the code displayed after execution):

1. Enter the mysql database:

 mysql> use mysql;
 Database changed

2. Set a new password for the root user. You need to enter the red bold part yourself:

mysql> update user set password=password("new password") where user="root";
Query OK, 1 rows affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

3. Refresh the database

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

4. Exit mysql:

mysql> quit
Bye

Step 4: Restore the my.ini file

After the change, modify the my.ini file again, delete the " skip-grant-tables " line we just added, save and exit, and restart mysql.

Summarize

The above is the editor's introduction to solving the mysql ERROR 1045 (28000)-- Access denied for user problem. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Solution to mysql ERROR 1045 (28000) 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
  • Solve mysql: ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: NO/YES)

<<:  Implementation of Docker data volume operations

>>:  Writing methods that should be prohibited in native JS

Recommend

MySQL service and database management

Table of contents 1. Start and stop service instr...

Unzipped version of MYSQL installation and encountered errors and solutions

1 Installation Download the corresponding unzippe...

Detailed explanation of browser negotiation cache process based on nginx

This article mainly introduces the detailed proce...

Ubuntu View and modify mysql login name and password, install phpmyadmin

After installing MySQL, enter mysql -u root -p in...

v-for directive in vue completes list rendering

Table of contents 1. List traversal 2. The role o...

Sample code for deploying Spring-boot project with Docker

1. Basic Spring-boot Quick Start 1.1 Quick start ...

JavaScript to achieve simple provincial and municipal linkage

This article shares the specific code for JavaScr...

Research on the Input Button Function of Type File

<br />When uploading on some websites, a [Se...

Details of MutationObServer monitoring DOM elements in JavaScript

1. Basic Use It can be instantiated through the M...

Example of using MySQL to count the number of different values ​​in a column

Preface The requirement implemented in this artic...

Use the CSS border-radius property to set the arc

Phenomenon: Change the div into a circle, ellipse...