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

Root users of mysql cannot authorize ordinary users to deal with the problem.

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

Share

Shulou(Shulou.com)06/01 Report--

Let's first look at the error phenomenon:

Oddly enough, it should be impossible for root users to authorize ordinary users. The hint seems to say the password is wrong. But actually there's nothing wrong with the password.

Decided to see what the permissions of the user root@localhost are in the mysql.user table. Globally related permission information is recorded in the mysql.user table. This global permission does not mean having all permissions, it specifically refers to having permissions for all database objects on the MYSQL server.

Mysql > select * from mysql.user where User='root' and Host='localhost'\ G

You can see that Grant_priv is N. Obviously, because the user root@localhost does not have permission to grant permissions, the previous operation reported an error. Change the value of Grant_priv to Y, refresh it, then log out and log back in. The problem is solved.

Mysql > update mysql.user set Grant_priv='Y' where User='root' and Host='localhost'

Mysql > flush privileges

Conclusion: this problem is not very common. But this problem provides a way to solve the problem, how to start when there is a problem with the authority. The granularity of permissions in mysql is global, database, table, column and program from coarse to fine. It can be summed up in one sentence: assign permission for a user to connect from a machine to access a part of a record in a column of a table under a database. The globally relevant permission information is recorded in the mysql.user table. The permission information at the record database level is the mysql.db table. The authorization information record for the record table object is in the mysql.tables_ private table. Column-level permissions are recorded in the mysql.column_ private table.

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