MariaDB¶
MariaDB is a free, open-source relational database management system (RDBMS) created by the original developers of MySQL
How to run a MariaDB on HPG (Example)¶
-
Prepare directories for a project using mariadb (one time)
$ mkdir -p /blue/ufhpc/username/projects/mysql/apptainer/{data,run} $ cd /blue/ufhpc/username/projects/mysql/apptainer
-
Prepare a personal config
$ cat ~/.my.cnf [mysqld] port=33306 innodb_use_native_aio=0 init-file=/home/username/.config/ufrc/personal_mysql_pw.txt [client] port=33306 user=root password='REDACTED' $ cat /home/username/.config/ufrc/personal_mysql_pw.txt SET PASSWORD FOR 'root'@'localhost' = PASSWORD('REDACTED'); $ export MARIADB_ROOT_PASSWORD="REDACTED"
-
Build container
$ apptainer build mariadb-11.sif docker://mariadb
-
Run instance
$ apptainer instance start --bind ${HOME},${PWD}/data/:/var/lib/mysql,${PWD}/run:/run/mysqld ./mariadb-11.sif mariadb INFO: Instance stats will not be available - requires cgroups v2 with systemd as manager. INFO: instance started successfully $ apptainer instance list INSTANCE NAME PID IP IMAGE mariadb 1695277 /blue/ufhpc/username/projects/mysql/apptainer/mariadb-11.sif $ apptainer run instance://mariadb 2025-05-13 14:42:03-04:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.7.2+maria~ubu2404 started. 2025-05-13 14:42:04-04:00 [Note] [Entrypoint]: Initializing database files 2025-05-13 14:42:14-04:00 [Note] [Entrypoint]: Database files initialized 2025-05-13 14:42:14-04:00 [Note] [Entrypoint]: Starting temporary server 2025-05-13 14:42:14-04:00 [Note] [Entrypoint]: Waiting for server startup 2025-05-13 14:42:14 0 [Note] Starting MariaDB 11.7.2-MariaDB-ubu2404 source revision 80067a69feaeb5df30abb1bfaf7d4e713ccbf027 server_uid ...
-
Test
$ apptainer exec mariadb-11.sif mariadb -h 127.0.0.1 -P 33306 mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 11.7.2-MariaDB-ubu2404 mariadb.org binary distribution 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 [MySQL]> Let's make sure we can connect from another job/session: $^C $ apptainer instance stop mariadb INFO: Stopping mariadb instance of /blue/ufhpc/username/projects/mysql/apptainer/mariadb-11.sif (PID=1700387) Set bind-address = 0.0.0.0 in ~/.my.cnf
-
Get a session on a different node
$ export DBHOST=firstnode.ufhpc $ apptainer exec mariadb-11.sif mariadb -h $DBHOST -P 33306 mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 11.7.2-MariaDB-ubu2404 mariadb.org binary distribution 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 [MySQL]>