Database connection failure

I’m setting up Nextcloud on an Ubuntu Server (18.10) using a LEMP stack. I’ve installed Nextcloud but when I try to finish I get an error message that reads:

Error when trying to create admin user:
Failed to connect to the database: An
exception occurred in driver:
SQLSTATE[HY000] [1698] Access denied
for user ‘root’@‘localhost’

I’m sure I’m missing a simple setting but I can’t figure out where. Can anyone help?


This simple step is essential if you want to access a database. You need to provide a valid database administrator account so that the installation can be done. You’ve not written which database you’re using but if it is e.g. MariaDB you should check-out how to administer users and access rights on the folliwng page:

The following SQL command e.g. will show you the list of existing database users:

# mysql -e "use mysql;SELECT user,host,select_priv,insert_priv,grant_priv FROM user;"

Okay, I’ve set up an admin user on MariaDB and granted it all privileges on the nextclouddb database. Still getting the same error, though.

Good news! I restarted MariaDB, tweaked a setting or two, and voila! I was able to finish the setup.


That sounds good :slightly_smiling_face: You find a good description how to set-up a database here:

1 Like

Since I’m about to try to install and configure Mariadb for NextCloud, by all means, please share the setting or two that you tweaked.:smiley:

I’m so sorry, I
don’t remember what settings I tweaked, but if you check out, she has an excellent tutorial, and responds to
questions and pleas for help quickly. No affiliation, just a
very satisfied user.


1 Like

Thank you! I appreciate it.