sysown / proxysql

High-performance MySQL proxy with a GPL license.
http://www.proxysql.com
GNU General Public License v3.0
6.03k stars 981 forks source link

Feature request for add support for init-command values per user at mysql_users attributes #4233

Open seikath opened 1 year ago

seikath commented 1 year ago

First, thank you in advance for this amazing product. Feature request :

  1. In particular I would like to use init-command configured in the mysql_users attributes Json column in a view to force SET ROLE upon connection per individual user. Example 1. row username: test-dev-get-role_user password: *587D79C44xxx13076Exxx1D3FBBDxxx01DxxxF66 active: 1 use_ssl: 1 default_hostgroup: 0 default_schema: schema_locked: 0 transaction_persistent: 1 fast_forward: 0 backend: 1 frontend: 0 max_connections: 20 attributes: {"init-command": "SET ROLE developer_rw ;","default-transaction_isolation":"READ UNCOMMITTED"} comment: dev:[proxysql test dev user to inherit a role privileges]

  2. In general, some other command line options would be handy to be added? https://mariadb.com/kb/en/mariadb-command-line-client/

Case : That would give a DBA much more control of the enterprise DB users connecting from different locations to a multiple DB instances, in production and staging, especially in case of multiple AWS/AZURE accounts.

Note: It is possible to prepend this to each executed query with a query rule per user, but that approach it not effective at all, and breaks the db connections of almost all of the MySQL/MariaDB GUI clients.

More detailed info about DB ROLES implementation here https://mariadb.com/kb/en/roles_overview/ Info about executing SQL using init-commend : https://mariadb.com/docs/skysql-dbaas/ref/mdb/cli/mariadb/init-command/

Again, thank you for your work on this.

renecannao commented 1 year ago

Hi @seikath . First, thank for the feedback.

It is a feature that can be implemented, but I wouldn't consider it very low priority especially because I believe there are at least 2 easy workarounds.

seikath commented 1 year ago

Hello Rene, Thank you for the fast response, and for the workarounds listed. I will give them a try.

Kind regards,