diff --git a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
index 81c9a162ba4d4c8e7e1a392d23b5a9c0c85ce008..88c193e7ffaebaa8967996a25a7c5819725ccd48 100644
--- a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
+++ b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
@@ -260,7 +260,7 @@ class SchemaMigrator
             } catch (StatementException $statementException) {
                 // Enrich the error message with the full invalid statement
                 throw new StatementException(
-                    $statementException->getMessage() . ' in statement ' . $statement,
+                    $statementException->getMessage() . ' in statement: ' . LF . $statement,
                     1476171315,
                     $statementException
                 );
diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
index 60deb489d5be409f353ff10b6d5c560b204f7020..7099ce7dc91a259797a0436c31d2a163dbb991fd 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
 use Doctrine\DBAL\DBALException;
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Schema\Exception\StatementException;
 use TYPO3\CMS\Core\Database\Schema\SchemaMigrator;
 use TYPO3\CMS\Core\Database\Schema\SqlReader;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -61,8 +62,19 @@ class DatabaseData extends AbstractStepAction
             $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $postValues['sitename']);
         }
 
-        $result = $this->importDatabaseData();
-        if (!empty($result)) {
+        try {
+            $result = $this->importDatabaseData();
+            if (!empty($result)) {
+                return $result;
+            }
+        } catch (StatementException $exception) {
+            $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
+            $errorStatus->setTitle('Import of database data could not be performed');
+            $errorStatus->setMessage(
+                'Error detected in SQL statement:' . LF .
+                $exception->getMessage()
+            );
+            $result[] = $errorStatus;
             return $result;
         }