Skip to content

Commit d275c93

Browse files
committed
Recover installation when creating the user failed
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 7391c81 commit d275c93

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/private/Setup/MySQL.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private function createDBUser($connection) {
129129
'exception' => $ex,
130130
'app' => 'mysql.setup',
131131
]);
132+
throw $ex;
132133
}
133134
}
134135

@@ -137,6 +138,9 @@ private function createDBUser($connection) {
137138
* @param IDBConnection $connection
138139
*/
139140
private function createSpecificUser($username, $connection): void {
141+
$rootUser = $this->dbUser;
142+
$rootPassword = $this->dbPassword;
143+
140144
try {
141145
//user already specified in config
142146
$oldUser = $this->config->getValue('dbuser', false);
@@ -179,6 +183,9 @@ private function createSpecificUser($username, $connection): void {
179183
'exception' => $ex,
180184
'app' => 'mysql.setup',
181185
]);
186+
// Restore the original credentials
187+
$this->dbUser = $rootUser;
188+
$this->dbPassword = $rootPassword;
182189
}
183190

184191
$this->config->setValues([

0 commit comments

Comments
 (0)