mariadb_initial_setup.sql.in 799 Bytes
Newer Older
1 2 3 4 5 6 7 8
USE mysql;
DROP FUNCTION IF EXISTS last_insert_grn_id;
{% set mroonga = parameter_dict.get('mroonga', 'ha_mroonga.so') -%}
{% if mroonga %}CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME '{{ mroonga }}';{% endif %}
DROP FUNCTION IF EXISTS sphinx_snippets;
#CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'ha_sphinx.so';

{% macro database(name, user, password) -%}
9
CREATE DATABASE IF NOT EXISTS `{{ name }}`;
10
{% if user -%}
11 12
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@localhost IDENTIFIED BY '{{ password }}';
13
{%- endif %}
14 15 16
{% endmacro -%}

{% for entry in parameter_dict['database-list'] -%}
17
{{   database(entry['name'], entry.get('user'), entry.get('password')) }}
18
{% endfor -%}