summaryrefslogtreecommitdiffstats
path: root/lib/private/Setup
diff options
context:
space:
mode:
authorHemanth Kumar Veeranki <hems.india1997@gmail.com>2016-10-31 16:32:22 +0530
committerHemanth Kumar Veeranki <hems.india1997@gmail.com>2016-10-31 16:32:22 +0530
commit2b7d63f56551bcbb67f4104104614ea314158779 (patch)
tree4e88fb0052937a206b35a544ea52baa639abe48b /lib/private/Setup
parent6d2d069c172f1af72f134e32f4e8fc1fffbed80b (diff)
downloadnextcloud-server-2b7d63f56551bcbb67f4104104614ea314158779.tar.gz
nextcloud-server-2b7d63f56551bcbb67f4104104614ea314158779.zip
Added Exception catch in case of DB User exists
Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
Diffstat (limited to 'lib/private/Setup')
-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()
+ ]);
+ }
}
/**