#!/bin/bash set -e # Initialize the database mysqld --initialize-insecure --user=mysql # Start MariaDB in the background mysqld_safe & sleep 10 # Create the database and user mysql -e "CREATE DATABASE IF NOT EXISTS moodle;" mysql -e "CREATE USER IF NOT EXISTS 'moodleuser'@'%' IDENTIFIED BY 'moodlepassword';" mysql -e "GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'%';" mysql -e "FLUSH PRIVILEGES;" # Shut down the server mysqladmin shutdown