#70304Database connection fails at install tool step 4
Description
Steps:
Clone the current master
Create FIRST_INSTALL
Database credentials: root, no password, socket
Select an existing empty database (“temp.vxvr”)
Enter username and password for admin user
Get exception:
#1270853884: TYPO3 Fatal Error: The current username, password or host was not accepted when the connection to the database was attempted to be established!
Analysis:
The first DatabaseConnection is established in \TYPO3\CMS\Install\Controller\Action\Step\DatabaseData::importDatabaseData
Neither $GLOBALS[‘TYPO3_DB’] is used nor gets the resulting connection (line 129) written to the global var.
After that, in \TYPO3\CMS\Install\Service\SqlSchemaMigrationService::getCollationForCharset@158, the connection gets established again, but $GLOBALS[‘TYPO3_DB’] is used. The DatabaseConnection in the global var has no established connection. This leads to a second try to establish the database connection, which fails.
Solution: Always use $GLOBALS[‘TYPO3_DB’] for database connections