#!/bin/bash source ${CONTAINER_SCRIPTS_PATH}/common.sh # Initialize the MySQL database (create user accounts and the initial database) function initialize_galera_database() { log_info 'Initializing database ...' if [[ "$MYSQL_VERSION" < "5.7" ]] ; then # Using --rpm since we need mysql_install_db behaves as in RPM log_info 'Running mysql_install_db ...' mysql_install_db --rpm --datadir=$MYSQL_DATADIR else log_info "Running mysqld --initialize-insecure ..." ${MYSQL_PREFIX}/libexec/mysqld --wsrep-on=OFF --wsrep-provider=none --initialize-insecure --datadir=$MYSQL_DATADIR --ignore-db-dir=lost+found "$@" fi start_local_mysql --wsrep-on=OFF --wsrep-provider=none "$@" if [ -v MYSQL_RUNNING_AS_SLAVE ]; then log_info 'Initialization finished' return 0 fi # Do not care what option is compulsory here, just create what is specified if [ -v MYSQL_USER ]; then log_info "Creating user specified by MYSQL_USER (${MYSQL_USER}) ..." mysql $mysql_flags < "5.6" ]] ; then mysql $mysql_flags <