diff --git a/stores/sql.go b/stores/sql.go index 2802528ba..5d9d9cea8 100644 --- a/stores/sql.go +++ b/stores/sql.go @@ -153,9 +153,7 @@ func NewMetricsSQLiteConnection(path string) gorm.Dialector { // NewMySQLConnection creates a connection to a MySQL database. func NewMySQLConnection(user, password, addr, dbName string) gorm.Dialector { - connString := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local&multiStatements=true", user, password, addr, dbName) - fmt.Println("DEBUG PJ: MySQL conn string", connString) - return mysql.Open(connString) + return mysql.Open(fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local&multiStatements=true", user, password, addr, dbName)) } func DBConfigFromEnv() (uri, user, password, dbName string) { diff --git a/stores/sql_test.go b/stores/sql_test.go index 37bbf3432..b0bbe695a 100644 --- a/stores/sql_test.go +++ b/stores/sql_test.go @@ -96,7 +96,7 @@ func newTestSQLStore(t *testing.T, cfg testSQLStoreConfig) *testSQLStore { var conn, connMetrics gorm.Dialector if dbURI != "" { - if tmpDB, err := gorm.Open(NewMySQLConnection(dbURI, dbUser, dbPassword, "")); err != nil { + if tmpDB, err := gorm.Open(NewMySQLConnection(dbUser, dbPassword, dbURI, "")); err != nil { t.Fatal(err) } else if err := tmpDB.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s`", dbName)).Error; err != nil { t.Fatal(err) @@ -104,8 +104,8 @@ func newTestSQLStore(t *testing.T, cfg testSQLStoreConfig) *testSQLStore { t.Fatal(err) } - conn = NewMySQLConnection(dbURI, dbUser, dbPassword, dbName) - connMetrics = NewMySQLConnection(dbURI, dbUser, dbPassword, dbMetricsName) + conn = NewMySQLConnection(dbUser, dbPassword, dbURI, dbName) + connMetrics = NewMySQLConnection(dbUser, dbPassword, dbURI, dbMetricsName) } else if cfg.persistent { conn = NewSQLiteConnection(filepath.Join(cfg.dir, "db.sqlite")) connMetrics = NewSQLiteConnection(filepath.Join(cfg.dir, "metrics.sqlite"))