Skip to content

Running MariaDB

The following instructions provide details on how to run a MariaDB SQL server on Hopper

First-Time Database Initialization

In order to start a MariaDB server, a database data directory must first be initialized. This directory will store the files assocated with the database.

Note

Ensure that there is no .my.cnf configuration file in your home directory before starting a MariaDB server. MySQL configuration files can interfere with MariaDB.

Load the MariaDB module and create your data directory

module load gnu12 mariadb
mkdir ~/my_database

Initialize the data directory for the database

$MARIADB_ROOT/scripts/mariadb-install-db --datadir=$HOME/my_database

Running the MariadDB server

Ensure the mariadb module is loaded and launch the server.

module load gnu12 mariadb
mariadbd-safe --datadir=$HOME/my_database --socket=$HOME/my_database/mysql.sock &

The MariaDB server is now running. See the logfile in $HOME/my_database

Note

Do not forget to stop the instance when done: mariadb --socket=$HOME/my_database/mysql.sock -e "SHUTDOWN;"

Connecting to the MariadDB server (From Local Node)

Start MariaDB Client in Interactive Mode

mariadb --socket=$HOME/my_database/mysql.sock

To issue commands from scripts

mariadb --socket=$HOME/my_database/mysql.sock -e "Database SQL Commands;"