Nextcloud version (eg, 12.0.2): 15.0.4.0 (Nextcloudpi v1.7.0)
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 9 (stretch)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.25 (Raspbian)
PHP version (eg, 7.1): 7.2
The issue you are facing:
I noticed that after an upgrade (not sure which one) I couldn’t connect to my nextcloud website, and after looking in the error log saw this:
[Sat Feb 23 21:00:18.764560 2019] [php7:error] [pid 1067] [client 51.52.161.75:64607] PHP Fatal error: Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES) in /var/www/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(D in /var/www/nextcloud/lib/private/DB/Connection.php on line 64
I found that the reason ncadmin couldn’t connect to the database was because the salted value in config.php was wrong for some reason, and after updating it to the actual password in plain text everything started working again. However security issues aside, it seems to automatically update back to the incorrect salted value after a time and the errors come back until I change it again.
My question is, why is this happening and how do I fix it permenantly?
Running into similar issue here, again DB connection error
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'ncadmin'@'localhost' (using password: YES) in /data/nextcloud/lib/private/DB/Connection.php:64
The above “fix” worked at first, I could even upgrade to NC 15.0.8 last night, but today the NCP upgrade to 1.13.0 is failing, the process seems to complete but only log error was relating to Zend
[ nc-update ]
Downloading updates
Performing updates
Cannot load Zend OPcache - it was already loaded
Config value squareSizes for app previewgenerator set to 32
Cannot load Zend OPcache - it was already loaded
Config value widthSizes for app previewgenerator set to 128 256 512
Cannot load Zend OPcache - it was already loaded
The fix has not resolved the issue in this case and appears to still be DB access related. NC now will not start due to DB connection issue.
Also of note is that “correcting” the DB user password back to ‘default’ which initially worked, now I see the password hashed in NCP-web when previously it was plain…
The solution I think would be to reset the DB user/s back to what they were originally as per the provisioning script https://github.com/nextcloud/nextcloudpi/blob/master/bin/ncp-provisioning.sh (installed locally in the NCP instance here /usr/local/bin/ncp-provisioning.sh ) but it also looks like it could possibly nuke the install too!
[Edit] ran the local script (after making it executable)…ran but hasn’t appeared to done much, restarted docker container but still no NC…