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

Mini Program to Implement the Complete Shopping Cart

The mini program implements a complete shopping c...

Detailed explanation of CocosCreator MVC architecture

Overview This article will introduce the MVC arch...

Tutorial on binary compilation and installation of MySql centos7 under Linux

// It took me a whole afternoon to install this, ...

What is TypeScript?

Table of contents 1. JavaScript issues 2. Advanta...

The complete usage of setup, ref, and reactive in Vue3 combination API

1. Getting started with setUp Briefly introduce t...

Optimization of MySQL thread_stack connection thread

MySQL can be connected not only through the netwo...

A brief analysis of CSS :is() and :where() coming to browsers soon

Preview versions of Safari (Technology Preview 10...

Solve the problem of garbled Chinese characters in Mysql5.7

When using MySQL 5.7, you will find that garbled ...

mysql installer community 8.0.12.0 installation graphic tutorial

This tutorial shares the installation of mysql in...

Mysql slow query optimization method and optimization principle

1. For comparison of date size, the date format p...

Let's learn about MySQL database

Table of contents 1. What is a database? 2. Class...

Even a novice can understand the difference between typeof and instanceof in js

Table of contents 1. typeof 2. instanceof 3. Diff...