summaryrefslogtreecommitdiffstats
path: root/setup/projects/adei/files/adei_init/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'setup/projects/adei/files/adei_init/mysql')
-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'@'%';