summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-11-02 20:22:48 +0100
committerGitHub <noreply@github.com>2016-11-02 20:22:48 +0100
commitf7d681d038fcd600b1716965ccbd22dd02fe19e6 (patch)
treeaf2440c7879f256fd1d9d3e36eb119db1a8ad43c /lib
parent50cb3a5e5ad1e8a215dee70b660ec899fc71ad09 (diff)
parent2b7d63f56551bcbb67f4104104614ea314158779 (diff)
downloadnextcloud-server-f7d681d038fcd600b1716965ccbd22dd02fe19e6.tar.gz
nextcloud-server-f7d681d038fcd600b1716965ccbd22dd02fe19e6.zip
Merge pull request #1958 from harry-7/1428issue
Added Exception catch and ignore for DBuser exists
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Setup/MySQL.php24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php
index c022616d8b3..d1399c8821c 100644
--- a/lib/private/Setup/MySQL.php
+++ b/lib/private/Setup/MySQL.php
@@ -87,14 +87,22 @@ class MySQL extends AbstractDatabase {
* @throws \OC\DatabaseSetupException
*/
private function createDBUser($connection) {
- $name = $this->dbUser;
- $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,
- // the anonymous user would take precedence when there is one.
- $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
- $connection->executeUpdate($query);
- $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
- $connection->executeUpdate($query);
+ try{
+ $name = $this->dbUser;
+ $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,
+ // the anonymous user would take precedence when there is one.
+ $query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
+ $connection->executeUpdate($query);
+ $query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
+ $connection->executeUpdate($query);
+ }
+ catch (\Exception $ex){
+ $this->logger->error('Database User creation failed: {error}', [
+ 'app' => 'mysql.setup',
+ 'error' => $ex->getMessage()
+ ]);
+ }
}
/**