简体   繁体   English

Mysql.User不显示所有特权

[英]Mysql.User doesn't show all of the privileges

A colleague of mine had recently created a couple of mysql (v 5.6.x) users (test purposes only). 我的一位同事最近创建了几个mysql(v 5.6.x)用户(仅用于测试目的)。 When I checked the mysql.user table, this is what I see: 当我检查mysql.user表时,这是我看到的:

mysql> select * from mysql.user;

+----------------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| Host           | User       | Password                                  | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin                | authentication_string | password_expired |
+----------------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+
| localhost      | root       | ***************************************** | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |                       |                       | N                |
| 127.0.0.1      | root       | ***************************************** | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |                       |                       | Y                |
| ::1            | root       | ***************************************** | Y           | Y           | Y           | Y           | Y           | Y         | Y           | Y             | Y            | Y         | Y          | Y               | Y          | Y          | Y            | Y          | Y                     | Y                | Y            | Y               | Y                | Y                | Y              | Y                   | Y                  | Y                | Y          | Y            | Y                      |          |            |             |              |             0 |           0 |               0 |                    0 |                       |                       | Y                |
| %              | readOnly   | ***************************************** | Y           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
| %              | complete   | ***************************************** | N           | N           | N           | N           | N           | N         | N           | N             | N            | N         | N          | N               | N          | N          | N            | N          | N                     | N                | N            | N               | N                | N                | N              | N                   | N                  | N                | N          | N            | N                      |          |            |             |              |             0 |           0 |               0 |                    0 | mysql_native_password |                       | N                |
+----------------+------------+-------------------------------------------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-----------------------+------------------+

Grants for the user complete 给用户的赠款完成

show grants for 'complete'@'%';
+-----------------------------------------------------------------------------------------------------------+
| Grants for complete@%                                                                                     |
+-----------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'complete'@'%' IDENTIFIED BY PASSWORD '*****************************************'   |
| GRANT ALL PRIVILEGES ON `test_db`.* TO 'complete'@'%'                                                     |
+-----------------------------------------------------------------------------------------------------------+

Grants for root on localhost 在本地主机上授予root

mysql> show grants for 'root'@'localhost';
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*****************************************' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------+

Question : Why do all the privileges appear as N in case of the user complete when they should be Y ? 问题 :当用户完成时,为什么所有特权都应为Y时所有特权都显示为N root also has all the privileges and they appear as Y . root也具有所有特权,并且显示为Y。 I checked, the user complete actually has all the permissions. 我检查了一下,用户完成实际上拥有了所有权限。

I was looking for the permissions in the wrong place. 我在错误的位置寻找权限。 This answer : https://stackoverflow.com/a/3893716/174184 gives me the answer. 这个答案: https : //stackoverflow.com/a/3893716/174184给了我答案。 mysql.user stores the global permissions while the permissions were given only for a particular db. mysql.user存储全局权限,而权限仅针对特定的数据库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 表 'mysql.user' 不存在:错误 - Table 'mysql.user' doesn't exist:ERROR mysql.user-列出列(特权)值作为记录 - mysql.user - list column (privileges) values as records 生成根密码时发生mysql错误,表'mysql.user'不存在' - mysql error at root password generation, Table 'mysql.user' doesn't exist' 无法打开和锁定权限表:表 'mysql.user' 不存在 - Can't open and lock privilege tables: Table 'mysql.user' doesn't exist MariaDB 10.4.10 错误 1146 (42S02):表 'mysql.user' 不存在 - MariaDB 10.4.10 ERROR 1146 (42S02): Table 'mysql.user' doesn't exist 服务mysql启动在我的日志文件中留下“特权表:表'mysql.user'不存在”并且服务器失败 - service mysql start leaves “privilege tables: Table 'mysql.user' doesn't exist” in my log file and the server fails Docker中的Bootstraping Percona Xtradb Cluster出现错误:无法打开和锁定特权表:表'mysql.user'不存在 - Bootstraping Percona Xtradb Cluster in Docker gives the error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist MySQL 8.0.18 角色对数据库的所有权限不允许用户创建数据库 - MySQL 8.0.18 all privileges on a database for role doesn't allow user to create the database mySQL上的mysql.user表 - mysql.user table on mySQL 无法重新启动 MySQL Docker 容器,出现“无法打开 mysql.plugin 表”和“表 'mysql.user' 不存在”等错误 - Cannot restart the MySQL Docker container, gives errors like `Can't open the mysql.plugin table` and `Table 'mysql.user' doesn't exist`
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM