[SOLVED] Nextcloud dead after sqlite --> MySQL Migration

Hi there,

after upgrading from SQLite to MySQL due to very slow performance, Nextcloud just no longer works. All i get is

—8<—
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.
—8<—

I used the following command

sudo -u http php occ db:convert-type --port 3306 --password ‘SECRET’ --clear-schema --all-apps mysql nextcloud 127.0.0.1 nextcloud

The Conversion went fine without any errors. Since then, Nextcloud is dead.

The last entry in the log file is from still using SQLite, there are no new log entries since the MySQL Conversion. PHP error log and syslog is also empty as is the HTTP Log.

Everything else on the Server still works fine, just Nextcloud is dead since exactly this command.

Nextcloud version (eg, 20.0.5): 28.0.3
Operating system and version (eg, Ubuntu 20.04): Archlinux-LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.58
PHP version (eg, 7.4): 8.3.3

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Migrate Database from SQLite to MySQL

The output of your Nextcloud log in Admin > Logging:
There is no logging happenig while or after the Upgrade of the Database. The last log entries are from still using SQLite

No Logs from PHP either. Nothing in syslog

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'SECRET',
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' => 
  array (
    0 => 'SECRET',
  ),
  'datadirectory' => '/mnt/data',
  'dbtype' => 'mysql',
  'version' => '28.0.3.2',
  'overwrite.cli.url' => 'https://SECRET/nextcloud',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_smtpname' => 'SECRET',
  'mail_smtppassword' => 'SECRET',
  'mail_from_address' => 'SECRET',
  'mail_domain' => 'SECRET',
  'mail_smtphost' => 'localhost',
  'mail_smtpport' => '25',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Movie',
    1 => 'OC\\Preview\\PNG',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\GIF',
    4 => 'OC\\Preview\\BMP',
    5 => 'OC\\Preview\\XBitmap',
    6 => 'OC\\Preview\\MP3',
    7 => 'OC\\Preview\\MP4',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
    10 => 'OC\\Preview\\PDF',
  ),
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'theme' => '',
  'loglevel' => 2,
  'maintenance_window_start' => 0,
  'mysql.utf8mb4' => true,
  'dbname' => 'nextcloud',
  'dbhost' => '127.0.0.1',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'SECRET',
);

The output of your Apache/nginx/system log in /var/log/____:
Mar 12 08:32:42 SECRET systemd[1]: Started Apache Web Server.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
Last error was about the SQLite database being locked. Nothing else afterwards

Okay uhm… not sure what to say.

It just magically started working again. Suddenly the log file started to pick up new logs and right when i wanted to start to post the log entries i thought “Hmmm lets just reload the index.php and see if it says the same” and it just works.

Don’t know what exactly it did in that time but whatever it did, it just works now.

It was almost certainly a cache issue. Often if you want to run the changes straight away you’ll need to restart what ever is running the PHP on your server to make sure it’s using the latest config.php settings.