Skip to content

Install fails if database user has no grant permission #13628

@thomasheller

Description

@thomasheller

Steps to reproduce

  1. Install Apache and MariaDB through apt
  2. Create database user:
create user 'next'@'localhost' identified by 'secret';
grant all privileges on *.* to 'next'@'localhost';
flush privileges;
  1. Create database:
create database next;
  1. Attempt to install Nextcloud in Web browser:

Username: [any]

Password: [any]

Data directory: [default]

Database user: next

Database password: secret

Database name: next

Database host: localhost:5432

Expected behaviour

Install should happen as normal, with the specified database user. Nextcloud should not attempt to add its own user if grant permission is missing.

Actual behaviour

Error message in Web browser:

Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1044] Access denied for user 'oc_next'@'localhost' to database 'next'

Subsequent error messages:

Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1044] Access denied for user 'oc_next1'@'localhost' to database 'next'

oc_next2 etc.

Server configuration

Operating system: Ubuntu 16.04.5 LTS

Web server: Apache/2.4.18

Database: mysql Ver 15.1 Distrib 10.0.36-MariaDB

PHP version: PHP 7.2.14

Nextcloud version: (see Nextcloud admin page) 53c077afc9077dcadcaf4b8ad62590fb549947b0

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

Where did you install Nextcloud from: directly from GitHub repository

Details

This bug occurs because the database user created for Nextcloud has permission to create new users, but is not allowed to grant permissions.

If privileges are granted with grant option, the install proceeds as expected (Nextcloud adds its own user):

grant all privileges on *.* to 'next'@'localhost' with grant option;

The bug is also described by this user: https://help.nextcloud.com/t/mariadb-refuse-me-sqlstate-hy000-1044-access-denied-for-user-oc-sylvain-to-database-nextcloud/35677

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions