summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/mk_sql_pair
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2016-04-13 16:37:26 +0200
committerlassulus <lass@aidsballs.de>2016-04-13 16:37:26 +0200
commitf0863085c7f865069e0d49a99488734abe044c6a (patch)
treecd7c1034a477e1ad37b88f13e6df0ddd855bee9c /lass/5pkgs/mk_sql_pair
parent6a009982af81f6591ee026c7f866008a17d4d8f8 (diff)
l 5: add mk_sql_pair
Diffstat (limited to 'lass/5pkgs/mk_sql_pair')
-rw-r--r--lass/5pkgs/mk_sql_pair/default.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/lass/5pkgs/mk_sql_pair/default.nix b/lass/5pkgs/mk_sql_pair/default.nix
new file mode 100644
index 000000000..a9f0d2797
--- /dev/null
+++ b/lass/5pkgs/mk_sql_pair/default.nix
@@ -0,0 +1,19 @@
+{ pkgs, ... }:
+
+pkgs.writeScriptBin "mk_sql_pair" ''
+ #!/bin/sh
+
+ name=$1
+ password=$2
+
+ if [ $# -ne 2 ]; then
+ echo '$1=name, $2=password'
+ exit 23;
+ fi
+
+ cat <<EOF
+ create database $name;
+ create user $name;
+ grant all on $name.* to $name@'localhost' identified by '$password';
+ EOF
+''