Recover installation when creating the user failed

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2022-08-12 09:43:38 +02:00
parent bbf7ad45c3
commit d09533cf28
No known key found for this signature in database
GPG key ID: 74434EFE0D2E2205

View file

@ -129,6 +129,7 @@ class MySQL extends AbstractDatabase {
'exception' => $ex,
'app' => 'mysql.setup',
]);
throw $ex;
}
}
@ -138,6 +139,9 @@ class MySQL extends AbstractDatabase {
* @return array
*/
private function createSpecificUser($username, $connection) {
$rootUser = $this->dbUser;
$rootPassword = $this->dbPassword;
try {
//user already specified in config
$oldUser = $this->config->getValue('dbuser', false);
@ -180,6 +184,9 @@ class MySQL extends AbstractDatabase {
'exception' => $ex,
'app' => 'mysql.setup',
]);
// Restore the original credentials
$this->dbUser = $rootUser;
$this->dbPassword = $rootPassword;
}
$this->config->setValues([