diff --git a/typo3/sysext/install/Classes/Command/SetupCommand.php b/typo3/sysext/install/Classes/Command/SetupCommand.php
index 4cf7ae647adcc935c0aa8feb05ea0b2efb52c3e3..12d38cc3add52dde47f1ba30ce4a1a78614737da 100644
--- a/typo3/sysext/install/Classes/Command/SetupCommand.php
+++ b/typo3/sysext/install/Classes/Command/SetupCommand.php
@@ -80,7 +80,7 @@ class SetupCommand extends Command
             ->addOption(
                 'port',
                 null,
-                InputOption::VALUE_REQUIRED,
+                InputOption::VALUE_OPTIONAL,
                 'Set the database port to use',
                 '3306'
             )
@@ -108,7 +108,7 @@ class SetupCommand extends Command
             ->addOption(
                 'admin-username',
                 null,
-                InputOption::VALUE_REQUIRED,
+                InputOption::VALUE_OPTIONAL,
                 'Set a username',
                 'admin'
             )
@@ -461,6 +461,7 @@ EOT
                         // All passed in values should go through the set validator,
                         // therefore, we can't break early
                         $validator = $question->getValidator();
+                        $envValue = $envValue ?: $default;
                         $value = $validator ? $validator($envValue) : $envValue;
                     }
 
@@ -491,6 +492,11 @@ EOT
             return $questionHelper->ask($input, $output, $questionUsername);
         }
 
+        // Use default value for 'admin-username' if in non-interactive mode
+        if ($usernameFromCli === false && !$input->isInteractive()) {
+            $usernameFromCli = $this->getDefinition()->getOption('admin-username')->getDefault();
+        }
+
         return $usernameValidator($usernameFromCli);
     }
 
@@ -528,7 +534,7 @@ EOT
         return $passwordValidator($passwordFromCli);
     }
 
-    protected function getAdminEmailAddress(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output): string|false
+    protected function getAdminEmailAddress(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output): string
     {
         $emailValidator = static function ($email) {
             if (!empty($email) && !GeneralUtility::validEmail($email)) {
@@ -549,7 +555,7 @@ EOT
             return $questionHelper->ask($input, $output, $questionEmail);
         }
 
-        return $emailValidator($emailFromCli);
+        return (string)$emailValidator($emailFromCli);
     }
 
     protected function getProjectName(QuestionHelper $questionHelper, InputInterface $input, OutputInterface $output): string