diff --git a/src/metabase/db/spec.clj b/src/metabase/db/spec.clj
index 7c1fd20fc37f905c6b68c7fd221481dce7e746a8..fc16f0d398f84d16f4dd0045f2d7132c63872921 100644
--- a/src/metabase/db/spec.clj
+++ b/src/metabase/db/spec.clj
@@ -24,7 +24,7 @@
   (merge
    {:classname                     "org.postgresql.Driver"
     :subprotocol                   "postgresql"
-    :subname                       (make-subname host port db)
+    :subname                       (make-subname host (or port 5432) db)
     ;; I think this is done to prevent conflicts with redshift driver registering itself to handle postgres://
     :OpenSourceSubProtocolOverride true}
    (dissoc opts :host :port :db)))
@@ -37,7 +37,7 @@
   (merge
    {:classname   "org.mariadb.jdbc.Driver"
     :subprotocol "mysql"
-    :subname     (make-subname host port db)}
+    :subname     (make-subname host (or port 3306) db)}
    (dissoc opts :host :port :db)))