diff --git a/modules/setting/database.go b/modules/setting/database.go index 6bfb02ac41e6..4e84f8f8d19b 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -105,7 +105,7 @@ func DBConnStr() (string, error) { switch Database.Type { case "mysql": connType := "tcp" - if Database.Host[0] == '/' { // looks like a unix socket + if len(Database.Host) > 0 && Database.Host[0] == '/' { // looks like a unix socket connType = "unix" } tls := Database.SSLMode