Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of ERROR 1045 (28000) error in MySQL

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to solve the problem of ERROR 1045 (28000) error in MySQL". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Error description:

Errors such as the title: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES). I log in with root@localhost authorization and give it to one of them.

A user is authorized, and then an error is reported as above:

[mysql@centos6-clone] $mysql-u root-p

Enter password:

Your MySQL connection id is 2

Server version: 5.6.25-log MySQL Community Server (GPL)

Mysql > grant all on *. * to 'fi'@'127.0.0.1' identified by "fi"

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

Mysql > exit

Bye

Root@localhost is supposed to be the highest authority. I can't believe you can't authorize anyone else. 1045 error is authorization refusal. What shall I do?

Second, error analysis

Check the root permissions:

Mysql > show grants

+-+

| | Grants for root@localhost |

+-+

| | GRANT ALL PRIVILEGES ON *. * TO 'root'@'localhost' IDENTIFIED BY PASSWORD' * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA' | |

| | GRANT PROXY ON'@''TO 'root'@'localhost' WITH GRANT OPTION |

+-+

2 rows in set (0.00 sec)

We see that root@localhost has permission: ALL PRIVILEGES, but no WITH GRANT OPTION statement, that is, the authority authorized by others. Therefore, the reason why it cannot be authorized is:

There is no such WITH GRANT OPTION statement.

Third, error resolution

Knowing the reason, it is easy to solve the problem. Log in to root@127.0.0.1 in another way, and then authorize root@localhost so that root@localhost can give it to other users

Authorized.

[mysql@centos6-clone] $mysql-uroot-p-h227.0.0.1

Enter password:

Mysql > SHOW GRANTS

->

+- -+

| | Grants for root@127.0.0.1 |

+- -+

| | GRANT ALL PRIVILEGES ON *. * TO 'root'@'127.0.0.1' IDENTIFIED BY PASSWORD' * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA' WITH GRANT OPTION |

+- -+

1 row in set (0.00 sec)

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'localhost' IDENTIFIED BY PASSWORD' * E74858DB86EBA20BC33D0AECAE8A8108C56B17FA' WITH GRANT OPTION

Query OK, 0 rows affected (0.00 sec)

Mysql > exit

[mysql@centos6-clone] $mysql-uroot-p

Enter password:

Mysql > grant all on *. * to 'fo'@'%' identified by "fo"

Query OK, 0 rows affected (0.00 sec)

This is the end of the content of "how to solve the problem of ERROR 1045 (28000) error in MySQL". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report