Configuring the MariaDB Jupyter Kernel

Config File Location

The kernel can be configured via a JSON file called mariadb_config.json.

The kernel will look for this config file in one of these two locations:

  1. If the JUPYTER_CONFIG_DIR environment variable is defined (non-empty) mariadb_kernel will try to read $JUPYTER_CONFIG_DIR/mariadb_config.json
  2. If the env variable is empty, the kernel will try to read $HOME/.jupyter/mariadb_config.json

Config Example

Here’s an example file containing some of the available options that you can pass to the kernel:

cat ~/.jupyter/mariadb_config.json
{
    "user": "root",
    "host": "localhost",
    "port": "3306",
    "password": "securepassword",
    "start_server": "True",
    "client_bin": "/usr/bin/mariadb",
    "server_bin": "/usr/bin/mariadbd"
}

By default the kernel tries to connect to a server running at localhost, on port 3306 using the user root with no password. You can change any of these options to fit your use-case. This also means you can run a notebook locally with a MariaDB kernel, and make the kernel connect to a server running in the cloud for instance.

The kernel, using the default configuration, looks for the mysql and mysqld binaries in your PATH. You can point (for example if you have a local MariaDB built from sources) the kernel to an exact location for these two binaries using the client_bin and server_bin options.

The start_server option tells the kernel to start a MariaDB Server instance for you, when the kernel is loaded, if it detects no running server given the configurations passed.

The Full List of JSON Options

If you suspect the documentation might not be up to date, you can check the complete list of available options at this link.

OptionDefaultExplanation
user“root”Kernel passes `--user=root` to the MariaDB client
host“localhost”Kernel passes `--host=localhost` to the MariaDB client
port“3306”Kernel passes `--port=3306` to the MariaDB client
password“”Kernel passes `--password=”your_pass”` to the MariaDB client
start_server“True”Start a server if no server running is detected for this config
client_bin“mysql”The name or path for the MariaDB client binary
server_bin“mysqld”The name or path for the MariaDB server binary

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.