Connect to MariaDB
Prerequisites
Section titled “Prerequisites”- You have a running instance of STACKIT MariaDB. If not, you can start with Create and manage instances for MariaDB.
- You have a user with proper permissions for the MariaDB database in your instance. If not, you can create one with Create and manage credentials for MariaDB
Connect to your MariaDB instance
Section titled “Connect to your MariaDB instance”After installing, open a shell of your choice and connect to your database. The mariadb command does not support the connection string format. You need the port, endpoint, database, username and the password of your instance to provide the necessary flags. You can look up all these parameters in the Credentials tab of your instance. You need to extract the port and the database from the connection string.
mariadb --host <ENDPOINT> --port <PORT> --user <USERNAME> --database <DATABASE> --passwordWhen your console shows something like this, you are connected successfully:
Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 585363Server version: 10.11.12-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [mad30dc70]>Press Control + D to close the connection and return to your command prompt.
mycli is a CLI tool to access the database. Follow the instructions on mycli’s install page or install it from the sources of your operating system.
After installing, open a shell of your choice and connect to your database. Mycli supports the connection string format. Copy the connection string you saved in the user creation step and use it in conjunction with the mycli-command.
mycli <Connection String>The CLI will answer with something like this:
dc70-1.data.eu01.onstackit.cloud:49271/mad30dc70MariaDB 10.11.12mycli 1.38.3Home: http://mycli.netBug tracker: https://github.com/dbcli/mycli/issuesThanks to the contributor - Open Query Pty Ltda9s87adfa95ea09124e3034355524d2@mad30dc70-1.data.eu01.onstackit.cloud(MariaDB):mad30dc70>Press Control + D to close the connection and return to your command prompt.