summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/mk_sql_pair/default.nix
blob: 738a8daf68a65318ced6d58851c8b153b2637c46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
''