Help with "Database user name and/or password not valid" when new install

I’m installing latest Nextcloud locally on Ubuntu 22.1. I have installed Nextcloud by separate parts, not by a snap or img or similarly. No installation errors or odd messages/events at all. But I am now stuck at a certain point and not sure how I can get around it.

I am stuck at the point where you open up the Nextcloud instance in the web browser for the 1st time, and enter a username and password for admin account, as well as name and password for the database connection, and finally click “Finish Setup”. In other words, this page:

(not my screenshot)

When I do, the PHP page returns an error message: “Database user name and/or password is not valid. You need to enter details of an existing account. Create an admin account.”

When I did the install process, I ran the below commands in Ubuntu terminal to set the above values:

sudo -u www-data php occ maintenance:install --database
“mysql” --database-name “nextcloud” --database-user “nextcloud” --database-pass \ “1234567” --admin-user “admin” --admin-pass “admin123”

These went through with no complaints from the dB.
I really feel this should work. But when I hit the “Finish Setup” button at the bottom of the web page, it just will not let me through. “Database user name and/or password is not valid” every time, no matter how creative I get.

I have also checked the database tables, no obvious errors, and “admin” is listed as the only users there.

What might be wrong here? Is the database entries- or connection messed up somehow? Or is it the web page or other part which doesn’t have write rights to the db?
Grateful for helpful suggestions, tips and reviews. Even lengthy ones.

Thank you

Hi @Ange.Reid, check if all of your database information are correct in this file: /.../nextcloud/config/CAN_INSTALL (where /... is the path of your nextcloud folder)

@Mageunic Thanks for response.
I am actually looking at that config.php file right now :slight_smile: It is located in my
/var/www/nextcloud/config -folder.
The PHP-file is empty. And whatever information I put in there, and save it, gets completely erased every time I reload the Nextcloud install web page and/or if I restart Apache2.
Trying to figure out why now …

@Ange.Reid ok …
are you sure all your informations are ok ??
On the web installer, what information have written for DB?

check of database name :

sudo mysql -u root -p
enter your admin password
then
SHOW databases;

a list of databases will show, check if yours is here.
then enter :
EXIT;

check of database user :
sudo mysql -u nextcloud -p
enter your password for nextcloud DB user
then enter this line again :
SHOW databases;
normally, your database will be shown in the list
then :
EXIT;

@Mageunic thx for helping.
As far as I can tell, I have seen no irregular things at all during the installation process. No errors, messages, nothing responding in a funny way … just nothing. Not until now, that is.

I ran the commands you suggested, and they all work out. The result of the lower one, shows me the following list of databases:

information_schema
nextcloud

That’s it. Nextcloud is there, though not at the top.

Also like to point out that I am using Ubuntu 22.1 and downloaded the latest nextcloud just the other day. Are there reasons to suspect Ubuntu 22.1 is slightly too new for Nextcloud at this time, or that specific care need to be taken regarding certain details?

@Ange.Reid strange … have you all dependencies needed for php ?

@Mageunic I would think that may have something to do with this too.
I have not yet set the usual php8.1-fpm variables in php.ini, or made the php-fpm pool configurations.
I seem to recall I didn’t need to do that far, before initializing the install from the web interface.

And now I managed to mess up apache too. I think I need to redo the process from the beginning, to eliminate whatever may have gone wrong here, and follow through much further, before I finish the installation from the web page.

1 Like

@Ange.Reid you don’t have to configures php.ini, just check if all additional packages of php needed for nextcloud is installed

@Mageunic I think I just solved it, by re-installing Ubuntu and doing it all from scratch.

I generally don’t like editing text/config files in the Ubuntu terminal VI. Instead, I’ve been using Sublime text editor. When I open the PHP and .conf files in Sublime, they’re blank. But when I open them in VI, there’s plenty of text/settings there.
Weird. I have no idea why. Maybe the Sublime editor is funky on Linux/Ubuntu, although I feel it shouldn’t be.

Anyway, I think I opened the config.php file in Sublime first, to edit it, found that it was empty (which was false) and so I added some of the parameters in there which should be there, using Sublime, and I hit SAVE in Sublime, effectively overwriting the config.php and thereby mucking things up. If you recall, I thought the file got overwritten every time restarted apache or reloaded the installation web page? That’s because I opened it in Sublime to check it, and saw (what I thought was) a blank file - again and again.

Now I have opened/edited the files in VI, all the way, and I’ve gotten past the hangup which I created this thread for. I can now login to my newly installed Nextcloud just fine.

Thank you for your help. Appreciated :slight_smile:

1 Like