Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 | |
| 3 # NOTE: Intended for development and testing only. In production execute the | |
| 4 # statements by hand. | |
| 5 | |
| 6 # Utility script to create or update the database. | |
| 7 | |
| 8 # get the command line arguments | |
| 9 MYSQL_PW=$1 | |
| 10 MYSQL_RO_PW=$2 | |
| 11 MYSQL_RW_PW=$3 | |
| 12 | |
| 13 if [[ -z $MYSQL_PW || -z $MYSQL_RO_PW || -z $MYSQL_RW_PW ]] | |
| 14 then | |
| 15 echo "Usage: $0 root_password readonly_password readwrite_password" | |
| 16 exit 1 | |
| 17 fi | |
| 18 | |
| 19 # Creat the database. Get the password for root from MYSQL_PW env variable. | |
| 20 mysql -h localhost -u root -p$MYSQL_PW mysql <<EOF | |
| 21 | |
| 22 # uncomment to drop the database | |
|
tfarina
2014/09/29 18:55:27
this comment says "uncomment", but the following l
| |
| 23 DROP DATABASE IF EXISTS skia; | |
|
jcgregorio
2014/09/29 16:59:07
This terrifies me. Can we just have the commands t
stephana
2014/09/29 18:07:50
That's why I have the note on top about this being
jcgregorio
2014/09/29 20:19:09
Thanks, let's keep the SQL statements in the docs.
stephana
2014/09/30 13:43:06
This file has been removed.
| |
| 24 | |
| 25 # uncomment to remove the users | |
| 26 GRANT USAGE ON *.* TO 'readonly'@'%'; | |
|
tfarina
2014/09/29 18:55:27
what '%' means? is it a shortcut to 'localhost'?
| |
| 27 GRANT USAGE ON *.* TO 'readwrite'@'%'; | |
| 28 DROP USER 'readonly'@'%'; | |
| 29 DROP USER 'readwrite'@'%'; | |
| 30 | |
| 31 CREATE DATABASE skia ; | |
|
tfarina
2014/09/29 18:55:27
nit: space between skia and ;
| |
| 32 CREATE USER 'readonly'@'%' IDENTIFIED BY '$MYSQL_RO_PW'; | |
| 33 GRANT SELECT ON *.* TO 'readonly'@'%'; | |
| 34 CREATE USER 'readwrite'@'%' IDENTIFIED BY '$MYSQL_RW_PW'; | |
| 35 GRANT SELECT, DELETE, UPDATE, INSERT ON *.* TO 'readwrite'@'%'; | |
| 36 EOF | |
| OLD | NEW |