Nextcloud can't find the users table

Every morning there are a dozen errors in the Nextcloud logs in this form.

TableNotFoundException An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_users’ doesn’t exist

There are no other errors, it’s not having a problem connecting to the database it just can’t find the table.

But when I log into mySql with the credentials from config.php I can

use nextcloud;

show table;

and they are all there including oc_users.

Surprisingly the web pages work fine and I can log in, but every morning when the errors come up it also deletes any files I had added since yesterday, which is a bit sub optimal.

I had recently changed the host from Debian 11 to 12 and updated the Nextcloud version as well. I seem to have ironed out any other problems but I can’t quite seem to track this one, any pointers would be appreciated.

Let me know if there’s other data that would be helpful.

John

Config.php (naughty bits excepted)

<?php $CONFIG = array ( 'passwordsalt' => 'XXX', 'secret' => 'XXX', 'trusted\_domains' => array ( 0 => 'localhost', ), 'datadirectory' => '/var/www/nextcloud/data', 'dbtype' => 'mysql', 'version' => '30.0.11.1', 'overwrite.cli.url' => 'https://NextCloud/', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc\_', 'mysql.utf8mb4' => true, 'dbuser' => 'ncadmin', 'dbpassword' => 'XXX', 'installed' => true, 'instanceid' => 'XXX', 'memcache.local' => '\\\\OC\\\\Memcache\\\\Redis', 'memcache.locking' => '\\\\OC\\\\Memcache\\\\Redis', 'redis' => array ( 'host' => '/var/run/redis/redis.sock', 'port' => 0, 'timeout' => 0.0, 'password' => 'XXX', ), 'tempdirectory' => '/var/www/nextcloud/data/tmp', 'mail\_smtpmode' => 'sendmail', 'mail\_smtpauthtype' => 'LOGIN', 'mail\_from\_address' => 'admin', 'mail\_domain' => 'ownyourbits.com', 'preview\_max\_x' => '2048', 'preview\_max\_y' => '2048', 'jpeg\_quality' => '60', 'overwriteprotocol' => 'https', 'loglevel' => '2', 'log\_type' => 'file', 'htaccess.RewriteBase' => '/', 'maintenance' => false, 'theme' => '', 'trusted\_proxies' => array ( 11 => '127.0.0.1', 12 => '::1', ), 'maintenance\_window\_start' => 2, 'default\_phone\_region' => '860', 'data-fingerprint' => 'XXX', );

Unfortunately you ignored the Support Template and didn’t provide any information about your environment, therefore it is difficult to recommend anything special.

The only thing which I realized is, that you are masking underscores in the configuration (\_). You should not do this.
Write e.g. “'dbtableprefix' => 'oc_',” instead of “'dbtableprefix' => 'oc\_',”. (BTW, that’s the default therefore there is no need to set that parameter in the configuration).

Same with “'memcache.local' => '\\\\OC\\\\Memcache\\\\Redis',”. It should be “'memcache.local' => '\\OC\\Memcache\\Redis',”.

You should also check the syntax of “'trusted_domains' => array ( 0 => 'localhost', ),” because I don’t believe that you want to access Nextcloud using the hostname “localhost”.

Those underscores must have been inserted while cutting and pasting into the forum, they’re not actually in the config file.

I trimmed the trusted domains array because I didn’t really want to advertise the external address of my instance. This isn’t an access problem, I can get to the web pages.

Obviously, I provided a great deal of information about the environment, but if you think there’s something else, relevant to this particular database problem, I can add that. I was hoping someone on the forum might be familiar enough with Nextcloud’s database handling to have some idea of how this problem could occur.

If you are doing it the right way there is no need to enter backslashes. You should usually copy configurations in a three back-tick block, like

```
<block of code>
```

The Support template has been created to make sure that required information is provide and to prevent lengthy discussions about what is needed or not. Please use it …