Home  >  Article  >  Database  >  Mysql 5.7.18 uses MySQL proxies_priv to achieve similar user group management instance sharing

Mysql 5.7.18 uses MySQL proxies_priv to achieve similar user group management instance sharing

小云云
小云云Original
2018-01-06 14:24:191575browse

This article mainly introduces in detail how MySQL 5.7.18 uses MySQL proxies_priv to achieve similar user group management. It has certain reference value. Interested friends can refer to it. I hope it can help everyone.

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

Role (Role) can be used to manage users in batches. Users under the same role have the same permissions.

After MySQL5.7.

##
mysql> show variables like "%proxy%"; #查看当前proxy是否开启,下图表示没有开启

##

mysql> set global check_proxy_users =on; #开启proxy 下图表示已开启
mysql> set global mysql_native_password_proxy_users = on;

mysql> exit
Bye #以上设置参数,对当前会话无效,需要退出后重新登录,或直接设置到my.cnf中去

2. Create user


mysql> create user will_dba; #类似组
mysql> create user 'will';
mysql> create user 'tom'; 
#密码就不设置了,如需设置密码后面加上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. View will_dba Permissions


mysql> show grants for will_dba;

6. View the permissions of will and tom


mysql> show grants for will;

##
mysql> show grants for tom;


7. View the permissions of proxies_priv


mysql> 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; #tom用户我们之前没有赋予权限,但这里可以查看
mysql> show tables;
mysql> select * from user\G


##mysql.proxies_priv is just a simulation of Role , and the role of Oracle is still different. 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

Related recommendations:

Detailed introduction on how to use rpm package to install mysql 5.7.18 in CentOS7

Mysql 5.7.18 decompressed version installation and Start instance method


Graphical tutorial on installation and configuration method of mysql 5.7.18 under CentOS 7

The above is the detailed content of Mysql 5.7.18 uses MySQL proxies_priv to achieve similar user group management instance sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn