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:
https://docs.nethserver.org/projects/nethserver-devel/en/latest/nethserver-nextcloud.html#full-reinstall

  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.

Steve

Blockquote [root@wp-files ~]# rpm -qa mariadb|sort
mariadb-5.5.68-1.el7.x86_64
mariadb-libs-5.5.68-1.el7.x86_64
mariadb-server-5.5.68-1.el7.x86_64
nethserver-rh-mariadb105-1.0.0-1.ns7.noarch
rh-mariadb105-3.7-1.el7.x86_64
rh-mariadb105-mariadb-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-common-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-config-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-errmsg-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-libs-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-server-10.5.16-2.el7.x86_64
rh-mariadb105-mariadb-server-utils-10.5.16-2.el7.x86_64
rh-mariadb105-runtime-3.7-1.el7.x86_64
Blockquote

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

2 Likes

Worked like a charm thank you so much.