js_lang privileges¶
This feature is a tech preview. Before using this feature in production, we recommend that you test restoring production from physical backups in your environment, and also use the alternative backup method for redundancy.
Privileges control what users can do. You use them to give specific permissions to different users. This ability helps you keep your data secure by only allowing authorized users to access and change information in the database.
Privileges¶
To create routines within a database, you must be granted the CREATE_JS_ROUTINE privilege and the standard CREATE ROUTINE privilege.
CREATE_JS_ROUTINE is a global privilege. The grant must use ON *.*.
GRANT CREATE_JS_ROUTINE ON *.* TO user1@localhost;
A schema-level grant fails.
GRANT CREATE_JS_ROUTINE ON jsdb.* TO user1@localhost;
Expected result
ERROR 3619: Illegal privilege level specified
If a user is granted the ability to create routines and holds the CREATE_JS_ROUTINE privilege, they are capable of creating stored functions and procedures using JS.
However, it is important to note that at this time, the creation of JS triggers or events is not supported.