Commit 3000a0a5 authored by Julien Muchembled's avatar Julien Muchembled

ERP5: escape database name and user when initializing MariaDB

parent 96ca850f
...@@ -183,7 +183,7 @@ md5sum = dd779e54d22105702aa72cadc994d957 ...@@ -183,7 +183,7 @@ md5sum = dd779e54d22105702aa72cadc994d957
[template-mariadb-initial-setup] [template-mariadb-initial-setup]
<= download-base <= download-base
filename = mariadb_initial_setup.sql.in filename = mariadb_initial_setup.sql.in
md5sum = b8d2d9af0c4cab45c8337aeac28d5fae md5sum = 6465212fdc7fe9076a0c929d9f14da14
[template-create-erp5-site] [template-create-erp5-site]
<= download-base <= download-base
......
...@@ -6,10 +6,10 @@ DROP FUNCTION IF EXISTS sphinx_snippets; ...@@ -6,10 +6,10 @@ DROP FUNCTION IF EXISTS sphinx_snippets;
#CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'ha_sphinx.so'; #CREATE FUNCTION sphinx_snippets RETURNS STRING SONAME 'ha_sphinx.so';
{% macro database(name, user, password) -%} {% macro database(name, user, password) -%}
CREATE DATABASE IF NOT EXISTS {{ name }}; CREATE DATABASE IF NOT EXISTS `{{ name }}`;
{% if user -%} {% if user -%}
GRANT ALL PRIVILEGES ON {{ name }}.* TO {{ user }}@'%' IDENTIFIED BY '{{ password }}'; GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON {{ name }}.* TO {{ user }}@'localhost' IDENTIFIED BY '{{ password }}'; GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@localhost IDENTIFIED BY '{{ password }}';
{%- endif %} {%- endif %}
{% endmacro -%} {% endmacro -%}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment