From b48daab7311065acb9f49e8544628d23535641c6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 5 Feb 2020 11:08:18 +0100 Subject: [PATCH] Check the new connection on setup like with PostgreSQL and Oracle Signed-off-by: Joas Schilling --- lib/private/Setup/MySQL.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/private/Setup/MySQL.php b/lib/private/Setup/MySQL.php index 964f16f3711..c125619f6d3 100644 --- a/lib/private/Setup/MySQL.php +++ b/lib/private/Setup/MySQL.php @@ -56,6 +56,16 @@ class MySQL extends AbstractDatabase { //fill the database if needed $query='select count(*) from information_schema.tables where table_schema=? AND table_name = ?'; $connection->executeQuery($query, [$this->dbName, $this->tablePrefix.'users']); + + $connection->close(); + $connection = $this->connect(); + try { + $connection->connect(); + } catch (\Exception $e) { + $this->logger->logException($e); + throw new \OC\DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'), + $this->trans->t('You need to enter details of an existing account.')); + } } /** -- 2.39.5