diff --git a/modules/Bio/EnsEMBL/Registry.pm b/modules/Bio/EnsEMBL/Registry.pm
index c30bc47d32ef0ec1ff10108bc123b1f452ab0b0a..f9ec9e4f28d803c049afdbb51fd4ebdb598f9172 100644
--- a/modules/Bio/EnsEMBL/Registry.pm
+++ b/modules/Bio/EnsEMBL/Registry.pm
@@ -1594,10 +1594,8 @@ sub load_registry_from_db {
   $user ||= "ensro";
   if ( !defined($port) ) {
     $port = 3306;
-    if ( $host eq "ensembldb.ensembl.org" ) {
-      if ( (!defined($db_version)) or ($db_version >= 48) ) {
-        $port = 5306;
-      }
+    if ( $host eq "ensembldb.ensembl.org" && defined($db_version) && $db_version < 48 ) {
+      $port = 4306;
     }
   }