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?

Ken

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: https://mariadb.com/kb/en/library/user-account-management/

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.

2 Likes

That sounds good :slightly_smiling_face: You find a good description how to set-up a database here: https://docs.nextcloud.com/server/15/admin_manual/configuration_database/linux_database_configuration.html

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
linuxbabe.com, she has an excellent tutorial, and responds to
questions and pleas for help quickly. No affiliation, just a
very satisfied user.

Ken

1 Like

Thank you! I appreciate it.