Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: perf/db/reset_mysqldb.sh

Issue 608273002: Add versioning to perf SQL database (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Clean up based on review in rietveld Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | perf/go/db/db.go » ('j') | perf/go/db/db.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: perf/db/reset_mysqldb.sh
diff --git a/perf/db/reset_mysqldb.sh b/perf/db/reset_mysqldb.sh
new file mode 100755
index 0000000000000000000000000000000000000000..81d1ef590daa066f75617a4e2478a261792c02df
--- /dev/null
+++ b/perf/db/reset_mysqldb.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# NOTE: Intended for development and testing only. In production execute the
+# statements by hand.
+
+# Utility script to create or update the database.
+
+# get the command line arguments
+MYSQL_PW=$1
+MYSQL_RO_PW=$2
+MYSQL_RW_PW=$3
+
+if [[ -z $MYSQL_PW || -z $MYSQL_RO_PW || -z $MYSQL_RW_PW ]]
+ then
+ echo "Usage: $0 root_password readonly_password readwrite_password"
+ exit 1
+fi
+
+# Creat the database. Get the password for root from MYSQL_PW env variable.
+mysql -h localhost -u root -p$MYSQL_PW mysql <<EOF
+
+# uncomment to drop the database
tfarina 2014/09/29 18:55:27 this comment says "uncomment", but the following l
+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.
+
+# uncomment to remove the users
+GRANT USAGE ON *.* TO 'readonly'@'%';
tfarina 2014/09/29 18:55:27 what '%' means? is it a shortcut to 'localhost'?
+GRANT USAGE ON *.* TO 'readwrite'@'%';
+DROP USER 'readonly'@'%';
+DROP USER 'readwrite'@'%';
+
+CREATE DATABASE skia ;
tfarina 2014/09/29 18:55:27 nit: space between skia and ;
+CREATE USER 'readonly'@'%' IDENTIFIED BY '$MYSQL_RO_PW';
+GRANT SELECT ON *.* TO 'readonly'@'%';
+CREATE USER 'readwrite'@'%' IDENTIFIED BY '$MYSQL_RW_PW';
+GRANT SELECT, DELETE, UPDATE, INSERT ON *.* TO 'readwrite'@'%';
+EOF
« no previous file with comments | « no previous file | perf/go/db/db.go » ('j') | perf/go/db/db.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698