Convert sqlite3 to MariaDB - Error 1146 Table 'nextcloud.oc_appconfig' doesn't exist

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

I tried to convert my sqlite3 backend to MariaDB like described here:

But after the latest command

sudo -u apache php occ db:convert-type --all-apps mysql USER HOST DB

I get this Error:

An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in PATH_TO_NEXTCLOUD/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130

  • Nextcloud Server version (e.g., 29.x.x):
    • 32.0.1.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Gentoo
  • Web server and version (e.g, Apache 2.4.25):
    • 2.4.65
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • -----
  • PHP version (e.g, 8.3):
    • 8.3
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • after executing the above mentioned command
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Upgrade sqlite to MariaDB
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

After executing the command

sudo -u apache php occ db:convert-type mysql nc_USER HOST DB

i get this error displayed:

An unhandled exception has been thrown:
PDOException: SQLSTATE\[42S02\]: Base table or view not found: 1146 Table ‘nextcloud.oc_appconfig’ doesn’t exist in PATH_TO_NEXTCLOUD/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:130
Stack trace:
PATH_TO_NEXTCLOUD/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(130): PDOStatement->execute()
PATH_TO_NEXTCLOUD/3rdparty/doctrine/dbal/src/Connection.php(1104): Doctrine\\DBAL\\Driver\\PDO\\Statement->execute()
PATH_TO_NEXTCLOUD/lib/private/DB/Connection.php(420): Doctrine\\DBAL\\Connection->executeQuery()
PATH_TO_NEXTCLOUD/lib/private/DB/ConnectionAdapter.php(50): OC\\DB\\Connection->executeQuery()
PATH_TO_NEXTCLOUD/lib/private/DB/QueryBuilder/QueryBuilder.php(291): OC\\DB\\ConnectionAdapter->executeQuery()
PATH_TO_NEXTCLOUD/lib/private/AppConfig.php(1360): OC\\DB\\QueryBuilder\\QueryBuilder->executeQuery()
PATH_TO_NEXTCLOUD/lib/private/AppConfig.php(284): OC\\AppConfig->loadConfig()
PATH_TO_NEXTCLOUD/lib/private/AppConfig.php(1832): OC\\AppConfig->searchValues()
PATH_TO_NEXTCLOUD/lib/private/Memcache/Factory.php(119): OC\\AppConfig->getAppInstalledVersions()
PATH_TO_NEXTCLOUD/lib/private/Memcache/Factory.php(153): OC\\Memcache\\Factory->getGlobalPrefix()
PATH_TO_NEXTCLOUD/lib/private/Server.php(932): OC\\Memcache\\Factory->createLocking()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(169): OC\\Server->OC{closure}()
PATH_TO_NEXTCLOUD/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\\AppFramework\\Utility\\SimpleContainer->OC\\AppFramework\\Utility{closure}()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(136): Pimple\\Container->offsetGet()
PATH_TO_NEXTCLOUD/lib/private/ServerContainer.php(154): OC\\AppFramework\\Utility\\SimpleContainer->query()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(45): OC\\ServerContainer->query()
PATH_TO_NEXTCLOUD/lib/private/Files/View.php(76): OC\\AppFramework\\Utility\\SimpleContainer->get()
PATH_TO_NEXTCLOUD/lib/private/Server.php(419): OC\\Files\\View->\__construct()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(169): OC\\Server->OC{closure}()
PATH_TO_NEXTCLOUD/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\\AppFramework\\Utility\\SimpleContainer->OC\\AppFramework\\Utility{closure}()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(136): Pimple\\Container->offsetGet()
PATH_TO_NEXTCLOUD/lib/private/ServerContainer.php(154): OC\\AppFramework\\Utility\\SimpleContainer->query()
PATH_TO_NEXTCLOUD/lib/private/AppFramework/Utility/SimpleContainer.php(45): OC\\ServerContainer->query()
PATH_TO_NEXTCLOUD/lib/private/Server.php(1257): OC\\AppFramework\\Utility\\SimpleContainer->get()
PATH_TO_NEXTCLOUD/lib/base.php(635): OC\\Server->boot()
PATH_TO_NEXTCLOUD/lib/base.php(1192): OC::init()
PATH_TO_NEXTCLOUD/console.php(31): require_once(‘…’)
PATH_TO_NEXTCLOUD/occ(33): require_once(‘…’)
…

Steps to replicate it (hint: details matter!):

  1. Doing all the Steps mentioned here: Converting database type — Nextcloud latest Administration Manual latest documentation

  2. Executing the Command:
    sudo -u apache php occ db:convert-type mysql USER HOST DB

Log entries

Nextcloud

no log entries cause command line is used

Web Browser

no log entries cause command line is used

Web server / Reverse Proxy

no log entries cause command line is used

Configuration

Nextcloud


<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
    2 => 'localhost',
    3 => '127.0.0.1',
    4 => '',
  ),
  'datadirectory' => '',
  'overwrite.cli.url' => '',
  #'dbtype' => 'sqlite3',
  'dbtype'        => 'mysql',
  'dbname'        => 'nextcloud',
  'dbuser'        => '',
  'dbpassword'    => '',
  'dbhost'        => 'localhost',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'version' => '32.0.1.2',
  'logtimezone' => 'UTC',
  'default_phone_region' => 'DE',
  'installed' => true,
  'maintenance_window_start' => 1,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 3,
  'debug' => false,
  'auth.bruteforce.protection.enabled' => false,
  'updater.release.channel' => 'stable',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Memcached',
  'app_install_overwrite' =>
  array (
    0 => 'calendar',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '',
  'mail_domain' => '',
  'mail_smtphost' => '',
  'mail_smtpport' => '465',
  'mail_smtpauth' => true,
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
);

Apps

Enabled:

  • activity: 5.0.0-dev.0
  • bookmarks: 16.0.1
  • bruteforcesettings: 5.0.0-dev.0
  • calendar: 6.0.3
  • circles: 32.0.0
  • cloud_federation_api: 1.16.0
  • comments: 1.22.0
  • contacts: 8.0.6
  • contactsinteraction: 1.13.1
  • dashboard: 7.12.0
  • dav: 1.34.2
  • federatedfilesharing: 1.22.0
  • federation: 1.22.0
  • files: 2.4.0
  • files_downloadlimit: 5.0.0-dev.0
  • files_pdfviewer: 5.0.0-dev.0
  • files_reminders: 1.5.0
  • files_sharing: 1.24.0
  • files_trashbin: 1.22.0
  • files_versions: 1.25.0
  • firstrunwizard: 5.0.0-dev.0
  • logreader: 5.0.0-dev.0
  • lookup_server_connector: 1.20.0
  • nextcloud_announcements: 4.0.0-dev.0
  • notes: 4.12.3
  • notifications: 5.0.0-dev.0
  • oauth2: 1.20.0
  • password_policy: 4.0.0-dev.0
  • photos: 5.0.0-dev.1
  • privacy: 4.0.0-dev.0
  • profile: 1.1.0
  • provisioning_api: 1.22.0
  • recommendations: 5.0.0-dev.0
  • related_resources: 3.0.0-dev.0
  • serverinfo: 4.0.0-dev.0
  • settings: 1.15.1
  • sharebymail: 1.22.0
  • support: 4.0.0-dev.0
  • survey_client: 4.0.0-dev.0
  • systemtags: 1.22.0
  • tasks: 0.17.1
  • text: 6.0.1
  • theming: 2.7.0
  • twofactor_backupcodes: 1.21.0
  • updatenotification: 1.22.0
  • user_status: 1.12.0
  • viewer: 5.0.0-dev.0
  • webhook_listeners: 1.3.0
  • workflowengine: 2.14.0
    Disabled:
  • admin_audit: 1.22.0
  • app_api: 32.0.0 (installed 32.0.0)
  • encryption: 2.20.0
  • files_external: 1.24.0
  • files_rightclick: 0.15.1 (installed 1.6.0)
  • suspicious_login: 10.0.0-dev.0
  • twofactor_nextcloud_notification: 6.0.0-dev.0
  • twofactor_totp: 14.0.0
  • user_ldap: 1.23.0
  • weather_status: 1.12.0 (installed 1.5.0)

looks you already changed your config.php to mysql.. but it supposed to happen after migration

On success the converter will automatically configure the new database in your Nextcloud config config.php.

Thx wwe!!! That was ist!

But now i have another error while migrating:

 An exception occurred while executing a query: SQLSTATE[22007]: Invalid dat
  etime format: 1366 Incorrect string value: '\xF0\x9F\xA5\x87 F...' for colu
  mn `nextcloud`.`oc_bookmarks`.`title` at row 1

But i habe enabled utf8mb4 like described here: Enabling MySQL 4-byte support — Nextcloud latest Administration Manual latest documentation

MariaDB [(none)]>  show variables like 'innodb_file_per_table';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| innodb_file_per_table | ON    |
+-----------------------+-------+
1 row in set (0.002 sec)

Database creaton was like this:

 CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

So i have to search further….

Solution found. I just had to add

‘mysql.utf8mb4’ => true,

in my config.php like described here

and migration finishes at it should!

1 Like