Database error after reinstalling Nextcloud

NethServer Version: 7.9
Module: Nextcloud

I could not get Nextcloud to start after hot syncing to a new machine so I removed and reinstalled Nextcloud now I’m getting a screen stating "Error while trying to create admin user: "Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘nextcloud’@‘localhost’ (using password: YES)"Create an admin account I have an admin account. I used the following to remove and reinstall. Any help with this issue would be greatly appreciated.

yum remove nethserver-nextcloud nextcloud
mysql -e "drop database nextcloud"
‘rm -Rf /usr/share/nextcloud’
yum install nethserver-nextcloud nextcloud

Probably caused by password mismatch between the password stored in mysql for nextcloud user and the password used to connect to the database (stored in /var/lib/nethserver/secrets/nextcloud).

Are you intending to do a new clean install (as you removed the database) or to recover the old one (importing database from backup, fixing mysql’s nextcloud user password and the password stored in secrets/nextcloud file to match…)?

If the former, one option could be to remove nextcloud user from mysql and remove secrets/nextcloud file, and then run yum reinstall nethserver-nextcloud (the rpm package will recreate both but with new credentials). For a full reinstall you have instructions on the manual:

  1. Uninstall Nextcloud using the admin page
  2. Drop the MySQL database: /opt/rh/rh-mariadb105/root/bin/mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "drop database nextcloud;"
  3. Remove the packages: yum remove nethserver-nextcloud
  4. Remove the whole Nextcloud directory: rm -rf /usr/share/nextcloud/
  5. Remove the e-smith DB configuration: config delete nextcloud
  6. Remove the NethServer config directory (WARNING: will remove user data): rm -rf /var/lib/nethserver/nextcloud
  7. Install Nextcloud from the Software Center

Thanks for the quick response, I just want to do a complete new install however when I run the command /opt/rh/rh-mariadb105/root/bin/mysql --socket=“/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock” -e “drop database nextcloud;” I get the following error.

Can’t connect to local MySQL server through socket ‘/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock’ (2)

check which versions of mariadb you have installed:

rpm -qa *mariadb*|sort

And check if the socket file exists and wheter corresponding services are running.

(Maybe you had an older version that was not using mariadb105)

Sorry its took me so long to get back to you looks like Nethserver is running the current version of mysql. I have attached an screenshot of the screen that loads when I try to access Nextcloud, thank you for all your help.


Blockquote [root@wp-files ~]# rpm -qa mariadb|sort

try continuing from step 3 (beware of step 6 as it removes all data from nextcloud users)


Worked like a charm thank you so much.