summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/mk_sql_pair/default.nix
blob: a9f0d27971b4a7a56b5afaba7afd1520942608e5 (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
''