Open seikath opened 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.
Workaround 1:
Create dedicated hostgroups pointing to the same server(s) , one hostgroup (or set of hostgroups) per user. Use mysql_hostgroup_attributes
to set init_connect
per hostgroup (so per user)
Workaround 2:
Create a store procedure on the backend that based on the username will execute SET ROLE
. Call the store procedure from ProxySQL's init_connect
.
Hello Rene, Thank you for the fast response, and for the workarounds listed. I will give them a try.
Kind regards,
First, thank you in advance for this amazing product. Feature request :
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]
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.