Bug #112881 Allow forcing a specific resource group for MySQL users for limiting CPU usage
Submitted: 30 Oct 2023 9:17 Modified: 30 Oct 2023 9:35
Reporter: Yoni Sade Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S4 (Feature request)
Version:8.2 OS:Any
Assigned to: CPU Architecture:Any

[30 Oct 2023 9:17] Yoni Sade
Description:
Currently, there's no way of forcing a specific resource group on MySQL user sessions in order to limit CPU usage.

Trying to change the USR_default resource group VCPU range value 
gives this error:
"SQL Error [3655] [HY000]: Alter operation is disallowed on default resource groups."

Trusting applications/users themselves to assign their own sessions to a resource group is risky.

How to repeat:
Run:

"ALTER RESOURCE GROUP USR_default VCPU = 0-1;"

Suggested fix:
I suggest MySQL to include this command:

"ALTER USER [USERNAME] SET RESOURCE GROUP [RG NAME];"

to force new sessions of [USERNAME] to be assigned to resource group [RG NAME], 
and also to change the resource group of all existing sessions for [USERNAME]
to [RG NAME].

*[RG NAME] was of course assumed to be created beforehand with VCPU=[limiting range]
[30 Oct 2023 9:35] MySQL Verification Team
Hello Yoni Sade,

Thank you for the reasonable feature request!
Related - Bug #15250

regards,
Umesh