lihongjie0209 / myblog

4 stars 0 forks source link

MySQL: 用户和权限 #281

Open lihongjie0209 opened 3 years ago

lihongjie0209 commented 3 years ago

MySQL 提供的权限点

Privilege Grant Table Column Context
ALL [PRIVILEGES] Synonym for “all privileges” Server administration
ALTER Alter_priv Tables
ALTER ROUTINE Alter_routine_priv Stored routines
CREATE Create_priv Databases, tables, or indexes
CREATE ROUTINE Create_routine_priv Stored routines
CREATE TABLESPACE Create_tablespace_priv Server administration
CREATE TEMPORARY TABLES Create_tmp_table_priv Tables
CREATE USER Create_user_priv Server administration
CREATE VIEW Create_view_priv Views
DELETE Delete_priv Tables
DROP Drop_priv Databases, tables, or views
EVENT Event_priv Databases
EXECUTE Execute_priv Stored routines
FILE File_priv File access on server host
GRANT OPTION Grant_priv Databases, tables, or stored routines
INDEX Index_priv Tables
INSERT Insert_priv Tables or columns
LOCK TABLES Lock_tables_priv Databases
PROCESS Process_priv Server administration
PROXY See proxies_priv table Server administration
REFERENCES References_priv Databases or tables
RELOAD Reload_priv Server administration
REPLICATION CLIENT Repl_client_priv Server administration
REPLICATION SLAVE Repl_slave_priv Server administration
SELECT Select_priv Tables or columns
SHOW DATABASES Show_db_priv Server administration
SHOW VIEW Show_view_priv Views
SHUTDOWN Shutdown_priv Server administration
SUPER Super_priv Server administration
TRIGGER Trigger_priv Tables
UPDATE Update_priv Tables or columns
USAGE Synonym for “no privileges” Server administration
lihongjie0209 commented 3 years ago

MySQL内部记录权限的表

表结构架构

判断当前的表数据适用范围

记录当前范围的授权

user 和 db

     
Table Name user db
Scope columns Host Host
  User Db
    User
Privilege columns Select_priv Select_priv
  Insert_priv Insert_priv
  Update_priv Update_priv
  Delete_priv Delete_priv
  Index_priv Index_priv
  Alter_priv Alter_priv
  Create_priv Create_priv
  Drop_priv Drop_priv
  Grant_priv Grant_priv
  Create_view_priv Create_view_priv
  Show_view_priv Show_view_priv
  Create_routine_priv Create_routine_priv
  Alter_routine_priv Alter_routine_priv
  Execute_priv Execute_priv
  Trigger_priv Trigger_priv
  Event_priv Event_priv
  Create_tmp_table_priv Create_tmp_table_priv
  Lock_tables_priv Lock_tables_priv
  References_priv References_priv
  Reload_priv  
  Shutdown_priv  
  Process_priv  
  File_priv  
  Show_db_priv  
  Super_priv  
  Repl_slave_priv  
  Repl_client_priv  
  Create_user_priv  
  Create_tablespace_priv  
Security columns ssl_type  
  ssl_cipher  
  x509_issuer  
  x509_subject  
  plugin  
  authentication_string  
  password_expired  
  password_last_changed  
  password_lifetime  
  account_locked  
Resource control columns max_questions  
  max_updates  
  max_connections  
  max_user_connections