Fresh install of NC 22.2.3 constantly fails

Hi guys,
I’ve been trying to install NC 22.2.3 for days now per CLI and the Wizard but it fails every time with this (error) message:

“MySQL username and/or password not valid. You need to enter details of an existing account.”

I’m trying to install on Ubuntu Server 20.04.3 with Apache 2.4.41, PHP 7.4.3 and MySQL 8.0.27. I had until recently NC 20.0.8 installed and running until I had HDD failure. I’ve retried so many times now I’ve lost count. Every time I deleted my chosen Admin user and the (empty) “nextcloud” database before retrying. I’ve started out creating the Admin user and database first and then start the install, but that did not matter. Immediately after deleting the Admin user and database I restarted the MySQL and Apache2 services, but always got the same result.

This is what I get at the CLI:

MySQL username and/or password not valid
→ You need to enter details of an existing account.
Trace: #0 /var/www/nextcloud/lib/private/Setup.php(351): OC\Setup\MySQL->setupDatabase()
#1 /var/www/nextcloud/core/Command/Maintenance/Install.php(108): OC\Setup->install()
#2 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#3 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#4 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#6 /var/www/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#7 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#8 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)
#9 {main}

Previous: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘oc_BeV_Admin1’@‘localhost’ (using password: YES)
Trace: #0 /var/www/nextcloud/lib/private/Setup/MySQL.php(64): OC\DB\Connection->connect()
#1 /var/www/nextcloud/lib/private/Setup.php(351): OC\Setup\MySQL->setupDatabase()
#2 /var/www/nextcloud/core/Command/Maintenance/Install.php(108): OC\Setup->install()
#3 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Maintenance\Install->execute()
#4 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#5 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#6 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#7 /var/www/nextcloud/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run()
#8 /var/www/nextcloud/console.php(99): OC\Console\Application->run()
#9 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)
#10 {main}

This is my Apache2 access_nextcloud.log log file (there are only 5 entries and the last one is:

localhost - - [06/Jan/2022:15:50:47 +0100] “GET /core/img/actions/info-white.svg?v=2 HTTP/1.1” 200 674 "http://nextcloud.local/core/css/guest.css?v=ba222ded25d957b900c03bef914333cd
" “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0”

I’ve googled and find it funny that others seem to have had this error, but seem to be completely different circumstances and solutions.

I really hope somebody can help me with this.

Oh, I forgot something relevant - I’m installing from the .zip file, no docker, no VM …

Thanks in advanced!

Robert,

Can you log into mysql from the command line?

mysql -u <username -p

If you can then check the username and permissions on the NC database. Seems to me that your login credentials are not correct for some reason. Once logged into mysql you can change the login password if you need too. Also check your config.php file for NC to see if the login info is correct.

Hi, yes I can. I’ve logged in as root, and the user I’ve created for mysql security reasons which is essentially a copy of the root user, only with a different name, and I tried per CLI (several times, which did create the NC Admin user/account), and I’ve also tried using the MySQL Workbench 8.0.27 which also creates the NC Admin user/account.

I’m at a real loss. It just doesn’t make sense to me why the installation tells be I need an existing Admin user even though I’ve created one. I’ve even restarted the mysql service after creating the new user, and also the apache service, and then started the install process again … and again …

How can I check/compare the NC config.php file for the password when they are sha2 encrypted/hashed. I that the hashes would be different. No?

What should the DB permissions be for the new NC Admin account?

First, Im no expert :frowning:

My config.php is not encrypted. So, I can not help you there and I do not know a lot about encrypting.

Here is a link to show grants/permissions in mariadb:

https://mariadb.com/kb/en/show-grants/

You mentioned that you log into mariadb (essentially mysql) with root but how about as the database user? Does that work?

Just curious, Your nextcloud config.php is encrypted?

I would think that perhaps your config.php is in error and needs to be altered to reflect your login to the database. I find problems like this are most likely stupid things like a wrong letter or symbol that we tend to overlook.

Can you tell me what O/S your running nextcloud on?

Trying to help,

No, not the entire config.php file, just the password(s) configured within the file. Actually I believe hashed is more appropriate, not necessarily encrypted. It’s just that they’re not “human readable” if you know what I mean, and as far as I understand, the same password can have a different hash depending on how (?) it’s hashed.

I have not tried to log in as the new NC Admin user yet. I’ll try that here soon.

The funny thing is that I got so fed-up with trying NC that I tried owncloud, and at first when I tried using the “&” character in the password the install failed, so I only changed the “&” to “$” and the install completed, with no errors. Needless to say, I tried the same thing again with NC, but still failed.

I’ve had various NC versions installed and running on the same hardware for quite some time now, currently with Ubuntu Server 20.04.3, until recent HDD failure. So I replaced the HDD (which was my NC data-dir to be honest) and now I’ve had to reinstall, so I of course went with 22.2.3.

Also, I’ve been following these instructions to the letter:
https://docs.nextcloud.com/server/22/admin_manual/installation/example_ubuntu.html

Hi Robert,
Ok, I understand the hashed passwords now. I run nextcloud for a client but it has no outside access. So, I do not really need to hash the passwords. Im running it on a debian VM in virtualbox and migrating calendar data/contacts right now for about 12 users. :frowning:

Like I said, Im not a guru but it does sound like your config.php passwords (hashed) do not match and that is causing the problem. Especially if you can login to mysql via the user you setup.

Hi coffee412,
I appreciate your help, in fact you’ve led me in the right direction… it apparently has to do with mysql 8.0, or at least my installation/setup. I can create the new NC Admin user, but when I try to login as the Admin user from the command line I get denied. I still need to figure out why though. Thanks so far for your help, and I’ll continue posting as I progress.

By-the-way, which version of mysql (or maria) are you using?

Server version: 10.3.31-MariaDB-0+deb10u1 Debian 10

The guide I used to setup nextcloud:

Could it be that mysql is running on localhost (127.0.0.1) and your trying with a domain name tied to another ip address? Or something similar?

Yep. Keep me up to date. I bet we figure this out :slight_smile: