I followed the tutorials online to the letter. I created a share on the array called nextcloud. I installed Mariadb, set my various passwords in the container and ran the container. I deleted the bottom variable as I didn’t want to use it.
Mariadb fired up with no errors in the logs. I then went to install Nextcloud. I used the linuxserver image (my preferred repository), changed the port number from 443 to 444 (Unraid needs 443), and fired her up.
I entered a new username and password (mindful to keep them different to the database credentials we set up in Mariadb). I then clicked on the database part but when it came to connecting to the database, I was continually met with this error:
Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000]  Access denied for user ‘…..’@’localhost’ (using password: YES)
- Changed every credential in Mariadb and nextcloud repeatedly, including removing non-alphanumeric characters
- Nuked both images and started over (including deleting the directories out of /appdata )
- I tried localhost:3306, 127.0.0.1:3306, my.server.ip.address:3306, nothing would connect
- I worked through countless varieties of combos of the Mariadb credentials to no-avail.
I started to look online for the answer, it seems I wasn’t the only one having this problem. I saw people recommending going into the shell of the Mariadb container and manually configuring a new user, but that all seemed like hardwork. Particularly as we already had the variables set in Unraid.
I decided to try and look into the database itself, and for that I needed adminer:
- Go to the Apps page and download and install adminer. I left everything as standard aside from changing the port.
- Ensure Mariadb is running, and then from the adminer webpage, select the database to connect to. Note: here you can connect to your nextcloud database as the user, or you can connect to Mariadb as root. I opted for the second. Username is root, and password is whatever you configured in the mariadb container (“MYSQL_ROOT_PASSWORD”). Enable permanent login at the bottom to save the credentials for next time (a list of your logins will save to the left).
- On a successful login, you should see a list of databases… You can ignore all of them aside from the nextcloud database you set up (yours might be named differently).
- Enter your nextcloud database and select Privileges (top right).
- You should see your user at the top. Click on Edit.
- I toggled off ‘All privileges’ and then toggled it back on. Hit save at the bottom. Now try to connect the database to Nextcloud.
For me, it connected straight away. For local host, at the bottom of the config screen, I literally just put in the address of the mariadb container, i.e. 192.x.x.x:3306 (I didn’t bother with http or https). After a minute or so deploying, I was staring at the Nextcloud login screen.
Installing the Nextcloud Client on Windows
I decided to use Chocolatey for this. If you’re not using choco, you need to be!
See here for more details. Installation was as simple as:
choco install nextcloud-client -y
Within 30 seconds, I was staring at my share in Windows.
Am I exactly sure what happened initially to stop me from making a successful connection? No. It looks to me like the database password that we set up in the container template for some reason didn’t take properly. Adminer seemed to allow me to essentially force the password through. Maybe this is a bug, or maybe by design. Either way, I’m now looking at a successful Nextcloud installation.
If anyone has any other ideas or explanations, I’m all ears. Better yet, why not join us on facebook to help share any other solutions or tips and tricks.
If you’re considering a renovation and looking at the structured wiring side of things, or maybe you just want to support the blog, have a look below at my smarthome book, it’s available in all the usual places (including paperback).