Base table or view not found: 1146 Table 'nextcloud.oc_appconfig' doesn't exist.

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 30.0.3.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Linux 6.6.51+rpt-rpi-2712 aarch64
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.62 (Debian) Server
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • docker on RPI

Summary of the issue you are facing:

I more or less blindly updated the docker container via a compose file. This composes both a mariaDB container and a nextcloud one. Since I only set it up a few months ago i am pretty sure, that I did not accidentally skipped a major release. However after ‘docker pull’ and ‘docker compose up -d’ no connection is possible as it is “forbidden”.

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

=> Searching for hook scripts (*.sh) to run, located in the folder "/docker-entrypoint-hooks.d/before-starting"
Warning: /var/www/html/config/redis.config.php differs from the latest version of this image at /usr/src/nextcloud/config/redis.config.php
==> Skipped: the "before-starting" folder is empty (or does not exist)
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.3. Set the 'ServerName' directive globally to suppress this message
[Wed May 07 23:06:50.087129 2025] [mpm_prefork:notice] [pid 1:tid 1] AH00163: Apache/2.4.62 (Debian) PHP/8.3.20 configured -- resuming normal operations
[Wed May 07 23:06:50.087230 2025] [core:notice] [pid 1:tid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
192.168.10.23 - user [07/May/2025:23:06:53 +0000] "GET /index.php/204 HTTP/1.1" 500 702 "-" "Mozilla/5.0 (Windows) mirall/3.16.4 (build 20250428) (Nextcloud, windows-10.0.26100 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.10.23 - user [07/May/2025:23:13:05 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "Mozilla/5.0 (Windows) mirall/3.16.4 (build 20250428) (Nextcloud, windows-10.0.26100 ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

192.168.10.23 - user [07/May/2025:23:06:53 +0000] "GET /index.php/204 HTTP/1.1" 500 702 "-" "Mozilla/5.0 (Windows) mirall/3.16.4 (build 20250428) (Nextcloud, windows-10.0.26100 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.10.23 - user [07/May/2025:23:13:05 +0000] "GET /status.php HTTP/1.1" 500 410 "-" "Mozilla/5.0 (Windows) mirall/3.16.4 (build 20250428) (Nextcloud, windows-10.0.26100 ClientArchitecture: x86_64 OsArchitecture: x86_64)"

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

I do not know how to find

PHP

Output of literally any ‘php occ…’ command in the docker container:

An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_appconfig' doesn't exist in /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(130): PDOStatement->execute(NULL)
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1104): Doctrine\DBAL\Driver\PDO\Statement->execute()
#2 /var/www/html/lib/private/DB/Connection.php(419): Doctrine\DBAL\Connection->executeQuery('SELECT `appid`,...', Array, Array, NULL)
#3 /var/www/html/lib/private/DB/ConnectionAdapter.php(50): OC\DB\Connection->executeQuery('SELECT `appid`,...', Array, Array)
#4 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(289): OC\DB\ConnectionAdapter->executeQuery('SELECT `appid`,...', Array, Array)
#5 /var/www/html/lib/private/AppConfig.php(1233): OC\DB\QueryBuilder\QueryBuilder->executeQuery()
#6 /var/www/html/lib/private/AppConfig.php(243): OC\AppConfig->loadConfig(NULL, false)
#7 /var/www/html/lib/private/legacy/OC_App.php(653): OC\AppConfig->searchValues('installed_versi...')
#8 /var/www/html/lib/private/Server.php(612): OC_App::getAppVersions()
#9 /var/www/html/lib/private/Memcache/Factory.php(112): OC\Server->OC\{closure}()
#10 /var/www/html/lib/private/Memcache/Factory.php(124): OC\Memcache\Factory->getGlobalPrefix()
#11 /var/www/html/lib/private/Server.php(968): OC\Memcache\Factory->createLocking('lock')
#12 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(153): OC\Server->OC\{closure}(Object(OC\Server))
#13 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#14 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(120): Pimple\Container->offsetGet('OCP\\Lock\\ILocki...')
#15 /var/www/html/lib/private/ServerContainer.php(155): OC\AppFramework\Utility\SimpleContainer->query('OCP\\Lock\\ILocki...', true)
#16 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(42): OC\ServerContainer->query('OCP\\Lock\\ILocki...')
#17 /var/www/html/lib/private/Files/View.php(74): OC\AppFramework\Utility\SimpleContainer->get('OCP\\Lock\\ILocki...')
#18 /var/www/html/lib/private/Server.php(422): OC\Files\View->__construct()
#19 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(153): OC\Server->OC\{closure}(Object(OC\Server))
#20 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#21 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(120): Pimple\Container->offsetGet('OC\\Files\\Node\\H...')
#22 /var/www/html/lib/private/ServerContainer.php(155): OC\AppFramework\Utility\SimpleContainer->query('OC\\Files\\Node\\H...', true)
#23 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(42): OC\ServerContainer->query('OC\\Files\\Node\\H...')
#24 /var/www/html/lib/private/Server.php(1303): OC\AppFramework\Utility\SimpleContainer->get('OC\\Files\\Node\\H...')
#25 /var/www/html/lib/base.php(634): OC\Server->boot()
#26 /var/www/html/lib/base.php(1156): OC::init()
#27 /var/www/html/console.php(28): require_once('/var/www/html/l...')
#28 /var/www/html/occ(33): require_once('/var/www/html/c...')
#29 {main}

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'upgrade.disable-web' => true,
  'instanceid' => 'xxxxx',
  'passwordsalt' => 'xxxxx',
  'secret' => 'xxxxx',
  'trusted_domains' =>
  array (
    0 => '192.168.10.52:8090',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '30.0.3.2',
  'overwrite.cli.url' => 'http://192.168.10.52:8090',
  'dbname' => 'nextcloud',
  'dbhost' => 'db:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxxxx',
  'installed' => true,
  'maintenance' => false,
);

The ‘nextcloud’ database in the MariaDB docker container exists but apparently has no tables in it.

Its been 3 days now and since i am quite new to the topic I really fear for my data…

Please post your Compose file.

The compose file:

services:
  db:
    image: mariadb:latest
    container_name: nextcloud-db
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=xxxxx
      - MYSQL_PASSWORD=xxxxx
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    user: 33:33
    volumes:
      - /mnt/nextcloud:/var/lib/mysql

  app:
    image: nextcloud:latest
    container_name: nextcloud
    restart: unless-stopped
    ports:
      - "8090:80"
    volumes:
      - /mnt/nextcloud:/var/www/html
    environment:
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=xxxxx
    depends_on:
      - db

volumes:
  db_data:
  app_data:

networks:
  nextcloud:
    external: true

With this configuration, you’re using the same underlying host bind mounts for both your app and db containers. This is not a valid deployment.

So the only solution would be to backup the folders contents, setup a new instance of the docker containers with empty and separate directories and then copy the /data contents into the new /data directory for the new instance to read it in?