summaryrefslogtreecommitdiffstats
path: root/setup/projects/adei/files/adei_init
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-02-25 23:37:04 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-02-25 23:37:04 +0100
commit4e5b055d02f7ab1f618fb2426cfff9ebc1c9678a (patch)
tree8abb0a5a80eb7e155975dbd884f3ea0b6f955f9f /setup/projects/adei/files/adei_init
parent93c950b8e2f06a62bb4b7b0f463eec125118aafc (diff)
downloadands-4e5b055d02f7ab1f618fb2426cfff9ebc1c9678a.tar.gz
ands-4e5b055d02f7ab1f618fb2426cfff9ebc1c9678a.tar.bz2
ands-4e5b055d02f7ab1f618fb2426cfff9ebc1c9678a.tar.xz
ands-4e5b055d02f7ab1f618fb2426cfff9ebc1c9678a.zip
A complete working ADEI templte, v1-alpha
Diffstat (limited to 'setup/projects/adei/files/adei_init')
-rw-r--r--setup/projects/adei/files/adei_init/mysql/adei.sql1
-rw-r--r--setup/projects/adei/files/adei_init/mysql/initdb.sh16
-rw-r--r--setup/projects/adei/files/adei_init/mysql/pma.sql17
3 files changed, 34 insertions, 0 deletions
diff --git a/setup/projects/adei/files/adei_init/mysql/adei.sql b/setup/projects/adei/files/adei_init/mysql/adei.sql
new file mode 100644
index 0000000..a17fcfe
--- /dev/null
+++ b/setup/projects/adei/files/adei_init/mysql/adei.sql
@@ -0,0 +1 @@
+GRANT ALL ON `adei_%`.* TO 'adei'@'%';
diff --git a/setup/projects/adei/files/adei_init/mysql/initdb.sh b/setup/projects/adei/files/adei_init/mysql/initdb.sh
new file mode 100644
index 0000000..f877520
--- /dev/null
+++ b/setup/projects/adei/files/adei_init/mysql/initdb.sh
@@ -0,0 +1,16 @@
+(
+ dir=$(dirname $0)
+ cd $dir
+
+ # Waiting until server is initialized
+ e=1
+ while [ $e -ne 0 ]; do
+ sleep 5
+ MYSQL_PWD="$MYSQL_PASSWORD" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1'
+ e=$?
+ done
+
+
+ cat adei.sql | awk "{ gsub(/@PWD@/, \"$PMA_PASSWORD\"); print }" | MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mysql -u root -h $HOSTNAME
+ #cat pma.sql | awk "{ gsub(/@PWD@/, \"$PMA_PASSWORD\"); print }" | MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mysql -u root -h $HOSTNAME
+)
diff --git a/setup/projects/adei/files/adei_init/mysql/pma.sql b/setup/projects/adei/files/adei_init/mysql/pma.sql
new file mode 100644
index 0000000..884284f
--- /dev/null
+++ b/setup/projects/adei/files/adei_init/mysql/pma.sql
@@ -0,0 +1,17 @@
+GRANT ALL ON `adei_%`.* TO 'adei'@'%';
+
+CREATE USER IF NOT EXISTS 'pma'@'%' IDENTIFIED BY '@PWD@';
+ALTER USER 'pma'@'%' IDENTIFIED BY '@PWD@';
+
+GRANT USAGE ON mysql.* TO 'pma'@'%';
+GRANT SELECT (
+Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
+Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
+File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
+Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
+Execute_priv, Repl_slave_priv, Repl_client_priv
+) ON mysql.user TO 'pma'@'%';
+GRANT SELECT ON mysql.db TO 'pma'@'%';
+#GRANT SELECT ON mysql.host TO 'pma'@'%';
+GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv) ON mysql.tables_priv TO 'pma'@'%';
+GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'%';