public static void dropAllTestDatabases() {
        final Predicate<String> dbNameMatchPredicate = DB_NAME_PATTERN.asMatchPredicate();
        doWithRootConnection(ThrowingConsumer.unchecked(connection -> {
            try (final Statement statement = connection.createStatement()) {
                final ResultSet resultSet = statement.executeQuery("SHOW DATABASES;");
                final List<String> dbNames = new ArrayList<>();
                while (resultSet.next()) {
                    final String dbName = resultSet.getString(1);
                    if (dbNameMatchPredicate.test(dbName)) {
                        dbNames.add(dbName);
                    }
                }

                for (String dbName : dbNames) {
                    LOGGER.info("Dropping test database {}", dbName);
                    statement.executeUpdate("DROP DATABASE " + dbName + ";");
                }
            }
        }));
    }
Verify there is a connection to the database on the root account.
stroom-test-common/src/main/java/stroom/test/common/util/db/DbTestUtil.java