diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index f1d9647de571656351587425ab2d17f3d6481f05..379aae86812f86ef52e9149fb0e7351559f0bf27 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -450,6 +450,14 @@ sms = enabled
 
 ; This section needs to be changed to match your database connection information
 [Database]
+; Connection string format is [platform]://[username]:[password]@[host]:[port]/[db]
+; where:
+; [platform] = database platform (mysql, oci8 or pgsql)
+; [username] = username for connection
+; [password] = password for connection (optional)
+; [host] = host of database server
+; [port] = port of database server (optional)
+; [db] = database name
 database          = mysql://root@localhost/vufind
 
 ; If your database (e.g. PostgreSQL) uses a schema, you can set it here:
diff --git a/module/VuFind/src/VuFind/Db/AdapterFactory.php b/module/VuFind/src/VuFind/Db/AdapterFactory.php
index edf0afd76263ddf3869d9122c9b4f9bb93941379..22c07fd2ecb3676a8659f9bb76a8fd8f2a4b4f46 100644
--- a/module/VuFind/src/VuFind/Db/AdapterFactory.php
+++ b/module/VuFind/src/VuFind/Db/AdapterFactory.php
@@ -146,7 +146,13 @@ class AdapterFactory
         list($type, $details) = explode('://', $connectionString);
         preg_match('/(.+)@([^@]+)\/(.+)/', $details, $matches);
         $credentials = isset($matches[1]) ? $matches[1] : null;
-        $host = isset($matches[2]) ? $matches[2] : null;
+        if (isset($matches[2])) {
+            if (strpos($matches[2], ':') !== false) {
+                list($host, $port) = explode(':', $matches[2]);
+            } else {
+                $host = $matches[2];
+            }
+        }
         $dbName = isset($matches[3]) ? $matches[3] : null;
         if (strstr($credentials, ':')) {
             list($username, $password) = explode(':', $credentials, 2);
@@ -160,12 +166,14 @@ class AdapterFactory
         // Set up default options:
         $options = [
             'driver' => $this->getDriverName($type),
-            'hostname' => $host,
+            'hostname' => isset($host) ? $host : null,
             'username' => $username,
             'password' => $password,
             'database' => $dbName
         ];
-
+        if (!empty($port)) {
+            $options['port'] = $port;
+        }
         return $this->getAdapterFromOptions($options);
     }
 }