Nextcloud 18 new install Synology + MariaDB: 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 'nc'@'localhost' (using password: YES)

I’m doing a new install of Nextcloud 18 on a Synology with MariaDB10 and PHP 7.3.
I used PhpMyAdmin to create a new user “nc” and a new db “nc” where user “nc” got all privileges.

At initial setup up screen of Nextcloud I enter an admin login and psw for Nextcloud and MariaDB info:
user: nc
psw: the password created while I create nc user in PhpMyAdmin
database: nc
host: localhost:3307 (MariaDB port, as I still have an old MariaDB5 running)

Then I always got this error:
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 ‘nc’@‘localhost’ (using password: YES)

I found a couple of post quoting this error but none provide a viable solution. I’m getting crazy, I did create and drop the db many time, select shorter password (but always with special character as requested by my db policy).
First I didn’t specified the port on localhost and was sure it was the reason because I have both MariaDB5 and 10 on the same server, but it’s not the issue.

Any help would be welcome.

Have you checked your {NC_INSTALL_DIR}/config/config.php

that the sql settings are there and contain

'dbname' => 'nc',
'dbhost' => 'localhost',
'dbport' => '3307',
'dbtableprefix' => 'oc_',
'dbuser' => 'nc',
'dbpassword' => 'your password here',

also does netstat -tlpen shows port 3307 is listening

I found a workaround. If I use localhost:3307 it’s looking at MariaDB 5 despite the fact that the port is 3306! I tried to initiate with root account and it created the db in MariaDB5.

I disabled MariaDB5 and tried again but not luck. Then I found a post about MariaDB and port issue, and it happens that if I enter 127.0.0.1:3307 it works!

Not sure where is the issue but what a waste of time for nothing at the end. I took the opportunity to clean up MariaDB5 (where my old Nextcloud 13 is still running but impossible to update) and will remove it completely once my new Nextcloud will be running fine and all account re-created and file transferred.