This error occurs when attempting to create a MySQL resource group with a name that already exists in the database. The fix involves either dropping the existing group, using a different name, or altering the existing group instead.
The ER_RESOURCE_GROUP_EXISTS error (error code 3650) is thrown when you execute a CREATE RESOURCE GROUP statement for a resource group name that already exists in your MySQL 8.0+ server. Resource groups are a feature introduced in MySQL 8.0 that allow administrators to manage thread resource allocation by grouping threads and assigning CPU and priority resources to them. Each resource group must have a unique name within the MySQL instance. When MySQL attempts to create a resource group and finds that the name is already in use, it rejects the operation with this error to prevent conflicts and ensure resource group name uniqueness.
Query the INFORMATION_SCHEMA to see all existing resource groups:
SELECT * FROM INFORMATION_SCHEMA.RESOURCE_GROUPS;Or check for a specific resource group:
SELECT * FROM INFORMATION_SCHEMA.RESOURCE_GROUPS
WHERE RESOURCE_GROUP_NAME = 'your_group_name';This will help you verify whether the resource group already exists and view its current configuration.
If you need to replace the existing resource group with new settings, drop it first:
DROP RESOURCE GROUP your_group_name;Note: You cannot drop the default system resource groups (USR_default and SYS_default). You also need the RESOURCE_GROUP_ADMIN privilege to drop resource groups.
After dropping, you can recreate it:
CREATE RESOURCE GROUP your_group_name
TYPE = USER
VCPU = 0-3
THREAD_PRIORITY = 5;If you want to change the configuration of an existing resource group instead of recreating it, use ALTER RESOURCE GROUP:
ALTER RESOURCE GROUP your_group_name
VCPU = 0-7
THREAD_PRIORITY = 10;This approach is safer than dropping and recreating, as it preserves the resource group and updates its properties without disrupting threads currently assigned to it.
If the existing resource group should remain unchanged, simply choose a different name:
CREATE RESOURCE GROUP new_group_name
TYPE = USER
VCPU = 4-7
THREAD_PRIORITY = 8;Resource group names must be unique within the MySQL instance, so using a descriptive, unique name prevents conflicts.
For migration or initialization scripts, add checks to prevent duplicate creation attempts. While MySQL does not support CREATE RESOURCE GROUP IF NOT EXISTS syntax, you can check existence programmatically:
-- Check if resource group exists
SET @group_exists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.RESOURCE_GROUPS
WHERE RESOURCE_GROUP_NAME = 'your_group_name');
-- Conditional creation would need to be handled in application codeIn application code (e.g., Node.js):
const [groups] = await connection.query(
"SELECT * FROM INFORMATION_SCHEMA.RESOURCE_GROUPS WHERE RESOURCE_GROUP_NAME = ?",
['your_group_name']
);
if (groups.length === 0) {
await connection.query(
"CREATE RESOURCE GROUP your_group_name TYPE = USER VCPU = 0-3"
);
}Resource groups require the thread_pool plugin or MySQL Enterprise Thread Pool. The RESOURCE_GROUP_ADMIN and RESOURCE_GROUP_USER privileges control who can create, alter, drop, and use resource groups. System resource groups (SYS_default) are for system threads, while user resource groups (USR_default and custom groups) are for user connections. When dropping a resource group, any threads currently assigned to it are automatically reassigned to the appropriate default group (USR_default for user threads or SYS_default for system threads). Resource groups are stored persistently and survive server restarts, which is why re-running creation scripts often causes this error. On some platforms, CPU affinity features may not be available, limiting the effectiveness of VCPU settings. Resource groups are particularly useful in high-concurrency environments where you need to prioritize certain workloads over others, such as isolating reporting queries from OLTP operations.
EE_WRITE (3): Error writing file
How to fix "EE_WRITE (3): Error writing file" in MySQL
CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters
How to fix "CR_PARAMS_NOT_BOUND (2031): No data supplied for parameters" in MySQL
CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed
How to fix "CR_DNS_SRV_LOOKUP_FAILED (2070): DNS SRV lookup failed" in MySQL
ERROR 1146: Table 'database.table' doesn't exist
How to fix "ERROR 1146: Table doesn't exist" in MySQL
ERROR 1040: Too many connections
How to fix "ERROR 1040: Too many connections" in MySQL