File size: 451 Bytes
398df76 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #!/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
|