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

How to connect to docker server using ssh

When I first came into contact with docker, I was...

JS implementation of Apple calculator

This article example shares the specific code of ...

Analysis of the locking mechanism of MySQL database

In the case of concurrent access, non-repeatable ...

CSS tips for implementing Chrome tab bar

This time let’s look at a navigation bar layout w...

Windows 10 installation vmware14 tutorial diagram

Software Download Download software link: https:/...

Implementation code of front-end HTML skin changing function

50 lines of code to change 5 skin colors, includi...

Web Design: Script Materials Reconstruct User Experience

<br />Original text: http://blog.rexsong.com...

HTML thead tag definition and usage detailed introduction

Copy code The code is as follows: <thead> &...

Vue Element front-end application development: Use of API Store View in Vuex

Table of contents Overview 1. Separation of front...

Solve the problem of blank gap at the bottom of Img picture

When working on a recent project, I found that th...

Vue.js manages the encapsulation of background table components

Table of contents Problem Analysis Why encapsulat...

nuxt.js multiple environment variable configuration

Table of contents 1. Introduction 2. Scenario 3. ...

How to draw a cool radar chart in CocosCreator

Table of contents Preface Preview text Graphics C...

MySQL 5.7.17 installation and configuration method graphic tutorial

This article shares the installation and configur...