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

Implementation of setting fixed IP when starting docker container

Network type after docker installation [root@insu...

Vue realizes the logistics timeline effect

This article example shares the specific code of ...

A complete guide to the Docker command line (18 things you have to know)

Preface A Docker image consists of a Dockerfile a...

Ubuntu installs multiple versions of CUDA and switches at any time

I will not introduce what CUDA is, but will direc...

Detailed analysis of when tomcat writes back the response datagram

The question arises This question arose when I wa...

Docker container log analysis

View container logs First, use docker run -it --r...

Comparison of the advantages of vue3 and vue2

Table of contents Advantage 1: Optimization of di...

Can't connect to local MySQL through socket '/tmp/mysql.sock' solution

Error message: ERROR 2002: Can't connect to l...

Common properties of frameset (dividing frames and windows)

A frame is a web page screen divided into several ...

Responsive layout summary (recommended)

Basic knowledge of responsive layout development ...

HTML web page creation tutorial Use iframe tags carefully

Using iframes can easily call pages from other we...

CSS pixels and solutions to different mobile screen adaptation issues

Pixel Resolution What we usually call monitor res...

Pure CSS to achieve a single div regular polygon transformation

In the previous article, we introduced how to use...

How to use vue3+TypeScript+vue-router

Table of contents Easy to use Create a project vu...

How to change the default character set of MySQL to utf8 on MAC

1. Check the character set of the default install...