Nextcloud fails to authenticate the MySQL user

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (Unknown (N/A)):
Operating system and version (FreeNAS):
Apache or nginx version (Apache 2.4.25):
PHP version ( 7.1):

The issue you are facing:
After installing the plugin, in the installation, I’m trying to create the admin user. Nextcloud responds with:
Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘admin0’@‘localhost’ (using password: YES)
I have entered a password for the database and the admin user, both have a username as well. I’m a complete newbie to Nextcloud, as well as to PHP and SQL. Nextcloud is running as an addon for FreeNAS, which itself is running on VMware ESXi 6.7.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Try another user name
  2. Log into MySQL (Not possible)
  3. Reinstalling the plugin

The output of your Nextcloud log in Admin > Logging:

Unable to paste out of FreeNAS jail

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Unable to paste out of FreeNAS jail

The output of your Apache/nginx/system log in /var/log/____:

Unable to paste out of FreeNAS jail

First, you need to get shell access swomehow and find a way to login to mysql. I dont know how this addon for freenas works, but it should be possible.

I like to setup my nextclouds on vanilla linux systems, so there are no frameworks between you and your application trying to abstract anything away from you. At first it seems easier, but in the end, you are not really aware whats going on, and i hate that.

If you are able to gain shell access to this thing:

Look in the config.php. If admin0 is stated as dbuser there. If so, put your pw in the line right in the next line where dbpassword is stated.

if not try to login to your sql database sudo mysql -p and grant the user access like this:

grant all privileges on nc to 'admin0'@'localhost' identified by '[pwstring]';

If it is running as a snap or docker or something else, this may be not applicable for you,…