Corrupt nextcloud db through nextant/solr indexing (connection.php)

I did install nextcloud on a CentOS 7 and it worked fine. I added Solr and after that the nextant app. The I started the indexing and the browser become unresponsive. I stopped and restarted, and I’m now in a situation where not even the nextcloud startpage appears.
Using occ I always get the message below (even with php occ maintenance:repair).
My question -> is there a way to completely rebuild the database of a existing installation?
Thank you for your interest in this issue.

First, I am sorry but I can’t help you on fixing your database, you should ask on a support forum.

Then, I don’t really see how this could have happen. You’re saying that you start the index and the browser stop responding ? how did you start that index ?

Dear Cult
I did start it with “php occ nextant:index” and then the browser froze.
I do see the first line of the error (… unable to open database file in /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:60…) and I aos found some posts relating to said line 60 - but they were related to driver issues. I did eliminate driver issues due to the fact that nextcloud did run ok before the above mentioned occ command.

However, the question is more towards the steps necessary to repair the situation - that nextcloud starts again and that the occ command starts working again - with out having to do a full re-install.

Thank you

Dear all,
managed to access my database ans saw that there was a database called nextcloud_db BUT this database had no tables. I can’t understand how these were lost (dropped)???

Thus my next step was to run: php occ maintenance:install --database
"mysql" --database-name “nextcloud” --database-user “root” --database-pass
"password" --admin-user “admin” --admin-pass “password”

which produces (naturally, since there are no tables…):
An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud_db.oc_appconfig’ doesn’t exist in /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:104

I’ll now drop this database and try again


cpauli, did you have a backup of the database? If you have a hosting, they may be able to revert changes in the past couple of days.

I did start it with “php occ nextant:index” and then the browser froze.

You should not execute the index from a browser terminal. Use putty instead of any remote ssh client.

no, unfortunately I dont. Now I have an empty nextcoud database and I can’t find a way to create the nextcloud oc_ tables. When I do “php occ” I get:
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2006] MySQL server has gone away in /var/www/html/nextcloud/lib/private/DB/Connection.php:60
Stack trace: #0 /var/www/html/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect() etc…

This is not the same behaviour as before, thus I want to close this discusson and come back once I’ve reinstalled the whole server (apache, mysql, nextcloud…)

Thank you for your answers


Hi cult,
I did run it on the server in a terminal… However I’ll start with a complete re-install of the server.

@cpauli in your next setup use mysqldump to automatically backup your database daily, You can create a cronjob or systemctl startup: mysqldump -u root --password=‘YourPassword’ NextCloudDBName > NCBackup_date +"%m%d%Y".bak
Even if you are just backing it up in the same directory it acts as a second backup for when things like this goes wrong.