Mysql 5.7.18 Using MySQL proxies_priv to implement similar user group management

Mysql 5.7.18 Using MySQL proxies_priv to implement similar user group management

Use MySQL proxies_priv (simulated role) to implement similar user group management

Roles can be used to manage users in batches. Users with the same role have the same permissions.

MySQL 5.7.X and later can simulate the role function, which can be achieved through mysql.proxies_priv simulation

1. Configure proxy

mysql> show variables like "%proxy%"; #Check whether the current proxy is enabled. The following figure shows that it is not enabled. 

mysql> set global check_proxy_users = on; #Enable proxy. The following figure shows that proxy is enabled.mysql> set global mysql_native_password_proxy_users = on;

mysql> exit
Bye #The above parameters are invalid for the current session. You need to log out and log in again, or set them directly in my.cnf

2. Create a user

mysql> create user will_dba; #Similar groupmysql> create user 'will';
mysql> create user 'tom'; 
#The password is not set. If you need to set a password, add identified by '123'

3. Map the permissions of will_dba to will,tom

mysql> grant proxy on will_dba to will;
mysql> grant proxy on will_dba to tom;

4. Grant actual permissions to will_dba (simulated role)

mysql> grant select on *.* to will_dba;

5. Check will_dba's permissions

mysql> show grants for will_dba;

6. Check the permissions of will and tom

mysql> show grants for will; 

mysql> show grants for tom;

7. Check the permissions of proxies_priv

mysql> select * from mysql.proxies_priv;

8. Verification

Use will and tom users to view the database

[root@test-1 ~]# mysql -utom -p
mysql> show databases; #We did not grant permissions to user tom before, but he can view it here mysql> show tables;
mysql> select * from user\G

mysql.proxies_priv is just a simulation of Role, which is different from Oracle's role. The official name is Role like

MySQL5.6.X needs to install a plug-in to simulate the Role function. For specific methods, please refer to:

https://dev.mysql.com/doc/refman/5.6/en/proxy-users.html

https://dev.mysql.com/doc/refman/5.6/en/pluggable-authentication.html

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of MySQL user rights management
  • Summary of basic user and permission management methods in MySQL
  • Sharing of user management methods under MySQL command line
  • Detailed explanation of MySQL user and permission management
  • Detailed explanation of MySQL user rights verification and management methods
  • PHP implements MySQL database connection operation and user management
  • MySQL User Management
  • In-depth explanation of MySQL user account management and permission management
  • Mysql database advanced usage of views, transactions, indexes, self-connections, user management example analysis
  • Example analysis of mysql user rights management
  • Analysis of MySQL user management operation examples
  • MySQL 8.0 user and role management principles and usage details

<<:  Vue+canvas realizes the effect of refreshing waterfall chart from top to bottom in real time (similar to QT)

>>:  An example of how to quickly deploy web applications using Tomcat in Docker

Recommend

Vue + element to dynamically display background data to options

need: Implement dynamic display of option values ...

Some tips on website design

In fact, we have been hearing a lot about web des...

Let's talk in depth about the principle and implementation of new in JS

Table of contents definition Constructor bodies a...

How to reset the root password of Mysql in Windows if you forget it

My machine environment: Windows 2008 R2 MySQL 5.6...

Example of deploying Laravel application with Docker

The PHP base image used in this article is: php:7...

Vue uses Canvas to generate random sized and non-overlapping circles

Table of contents Canvas related documents Effect...

Detailed explanation of custom instructions for Vue.js source code analysis

Preface In addition to the default built-in direc...

MySQL randomly extracts a certain number of records

In the past, I used to directly order by rand() t...

Use of docker system command set

Table of contents docker system df docker system ...

Write a React-like framework from scratch

Recently I saw the article Build your own React o...

Example test MySQL enum type

When developing a project, you will often encount...

How to configure MySQL scheduled tasks (EVENT events) in detail

Table of contents 1. What is an event? 2. Enable ...

Reasons and solutions for the failure of React event throttling effect

Table of contents The problem here is: Solution 1...

Eight ways to implement communication in Vue

Table of contents 1. Component Communication 1. P...