Install js_lang component¶
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.
The plugin_dir system variable specifies where the component library is located. If you need to, you should set the plugin_dir variable when you start the server.
Install the percona-server-js package before you install the js_lang component. This package provides support for server-side JavaScript stored programs in Percona Server.
Run the command for your operating system:
sudo apt install percona-server-js
The apt package installs the library in /usr/lib/mysql/plugin/. This path is the value of plugin_dir.
sudo dnf install percona-server-js
For more information about the percona-server-js package, see DEB repository package list and Yum repository package list.
To install the js_lang component, you need to run the following command:
INSTALL COMPONENT 'file://component_js_lang';
When you install the component_js_lang, it gives you a new global privilege called CREATE_JS_ROUTINE. This privilege enables you to create JS routines within the database.
Grant CREATE_JS_ROUTINE to the account that will create routines, even root.
GRANT CREATE_JS_ROUTINE ON *.* TO root@localhost;
Creating a routine without this privilege fails with ERROR 1227. The error names CREATE_JS_ROUTINE.
For more information about this privilege, see js_lang privileges.
Note
Running INSTALL COMPONENT a second time returns ERROR 3529: Cannot load component from specified URN.
If you uninstall the js_lang component, restart the server before you install it again. Reinstalling without a restart fails with ERROR 6000: Re-installing the component without server restart is not supported.
After the restart, run INSTALL COMPONENT again.
For more details, check out INSTALL COMPONENT.