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

Implementation of MySQL scheduled database backup (full database backup)

Table of contents 1. MySQL data backup 1.1, mysql...

Example of how to install kong gateway in docker

1. Create a Docker network docker network create ...

Detailed explanation of MySQL master-slave replication and read-write separation

Article mind map Why use master-slave replication...

Web lesson plans, lesson plans for beginners

Teaching Topics Web page Applicable grade Second ...

JS implements click drop effect

js realizes the special effect of clicking and dr...

mysql 8.0.15 winx64 decompression version graphic installation tutorial

Every time after installing the system, I have to...

Summary of related functions for Mysql query JSON results

The JSON format field is a new attribute added in...

Mysql cannot select non-aggregate columns

1. Introduction I recently upgraded my blog and a...

Vue realizes picture switching effect

This article example shares the specific code of ...

Implementation of element input box automatically getting focus

When making a form in a recent project, I need to...

Use simple jQuery + CSS to create a custom a tag title tooltip

Introduction Use simple jQuery+CSS to create a cus...

How to improve MySQL Limit query performance

In MySQL database operations, we always hope to a...

Summary of common operation skills of MySQL database

This article summarizes common operating techniqu...