Merge pull request #1958 from harry-7/1428issue

Added Exception catch and ignore for DBuser exists
This commit is contained in:
Lukas Reschke 2016-11-02 20:22:48 +01:00 committed by GitHub
commit f7d681d038
1 changed files with 16 additions and 8 deletions

View File

@ -87,6 +87,7 @@ class MySQL extends AbstractDatabase {
* @throws \OC\DatabaseSetupException * @throws \OC\DatabaseSetupException
*/ */
private function createDBUser($connection) { private function createDBUser($connection) {
try{
$name = $this->dbUser; $name = $this->dbUser;
$password = $this->dbPassword; $password = $this->dbPassword;
// we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one, // we need to create 2 accounts, one for global use and one for local user. if we don't specify the local one,
@ -96,6 +97,13 @@ class MySQL extends AbstractDatabase {
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'"; $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
$connection->executeUpdate($query); $connection->executeUpdate($query);
} }
catch (\Exception $ex){
$this->logger->error('Database User creation failed: {error}', [
'app' => 'mysql.setup',
'error' => $ex->getMessage()
]);
}
}
/** /**
* @param $username * @param $username