SERVICE_USER="mysql" # execute command as another user EXEC_CMD_BIN="mysqld" # command to execute EXEC_CMD_ARGS="--user=$SERVICE_USER --datadir=$DATABASE_DIR" # command arguments if [ ! -d "$DATABASE_DIR/mysql" ] || [ ! -f "$DATABASE_DIR/ibdata1" ]; then mkdir -p "$DATABASE_DIR" && chown -Rf $user:$user "$DATABASE_DIR" mysql_install_db --datadir=$DATABASE_DIR --user=$user 2>/dev/null fi ( if [ -f "$CONF_DIR/mysql/init.sh" ]; then bash -c "$CONF_DIR/mysql/init.sh" fi if [ -n "$DATABASE_CREATE" ]; then mysql -v -u $runas </dev/stderr >/dev/null