diff --git a/README.md b/README.md index 24b396e..6404892 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Usage of ./myprofiler: -dump="": Write raw queries to this file -host="localhost": Host of database -interval=1: (float) Sampling interval - -password="": Password + -password="": Password - Can also be supplied using environment variable `MYSQL_PWD` -port=3306: Port -last=0: (int) Last N samples are summarized. 0 means summarize all samples -top=10: (int) Show N most common queries diff --git a/myprofiler.go b/myprofiler.go index 0d8ecb6..5fc14ee 100644 --- a/myprofiler.go +++ b/myprofiler.go @@ -224,7 +224,7 @@ func main() { cfg := Config{} flag.StringVar(&host, "host", "localhost", "Host of database") flag.StringVar(&dbuser, "user", dbuser, "User") - flag.StringVar(&password, "password", "", "Password") + flag.StringVar(&password, "password", os.Getenv("MYSQL_PWD"), "Password") flag.IntVar(&port, "port", 3306, "Port") flag.StringVar(&dumpfile, "dump", "", "Write raw queries to this file")