Internal Server Error aftter upgrading backend MySQL Server

I have NC server 24.0.5 currently running on an AWS LightSail instance. To offload processing, we created a separate Lightsail MySQL database and pointed our installation to that instance. Everything has been working fine, with the exception of excessive SQL queries during sync client updates. We’ve decided to update the SQL backend to a larger LightSail instance to provide some additional memory and bandwidth.

I created a snapshot (backup) of the existing Database and created a larger instance from it. I thought I would only have to change the dbname & dbhost entries in the config.php file.

Upon doing so and rebooting, we get the following while trying to access the new database instance.

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.

The new database is an exact copy of the existing working database, except for the database name, as AWS will not allow duplicated database names, even though they reside on different URL’s.

I’m pretty confident it’s a database permissions issue, but I’m at a loss for getting it understood…

Any help from the community is GREATLY appreciated.

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

[/details]

Nextcloud version (eg, 20.0.5): 24.0.5
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): nginx/1.18.0 (Ubuntu)
PHP version (eg, 7.4): 7.4.3

The issue you are facing:

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

Steps to replicate it:

  1. Install NC 24.0.x on AWS LightSail instance, and create separate LightSail database.
  2. Create new, larger LightSail database instance from existing database.
  3. Update config.php hostname and database parameters
  4. Access NC via CNAME URL… - Internal Server Error

The output of your Nextcloud log in Admin > Logging:

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

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxqsThBsp6EHLjyq',
  'secret' => 'xxxxxxxxxx+BRXb+/n3V27U6SF6wIqZ',
  'trusted_domains' => 
  array (
    0 => 'xxxxxxxxxx',
    1 => 'xxxxxxxxxx',
    2 => 'xxxxxxxxxx',
  ),
  'simpleSignUpLink.shown' => false,
  'defaultapp' => 'files',
  'quota_include_external_storage' => false,
  'versions_retention_obligation' => 'disabled',
  'allow_local_remote_servers' => true,
  'datadirectory' => '/mnt/nextcloud-filestore',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'loglevel' => 0,
  'log_rotate_size' => '104857600',
  'preview_max_memory' => 512,
  'preview_max_scale_factor' => NULL,
  'preview_max_x' => NULL,
  'proview_max_y' => NULL,
  'skeletondirectory' => '',
  'templatedirectory' => '',
  'dbtype' => 'mysql',
  'version' => '24.0.5.1',
  'overwrite.cli.url' => 'https://xxxxxxxxxx',
  'dbname' => 'TDG-xxxxxxxxxx_DB-server1',
  'dbhost' => 'xxxxxxxxxx8b45ebf65053f94c.clmlgzy35ima.us-east-1.rds.amazonaws.com:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'oc_xxx_xxxxxxstr',
  'dbpassword' => '5ZTUaOh6cD0jQRxxxxxxxxxx',
  'installed' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'timeout' => 0,
    'dbindex' => 0,
    'port' => 6379,
  ),
  'opcache.enable' => '1',
  'opcache.interned_strings_buffer' => '8',
  'opcache.max_accelerated_files' => '10000',
  'opcache.memory_consumption' => '128',
  'opcache.revalidate_freq' => '1',
  'opcache.save_comments' => '1',
  'default_language' => 'en',
  'default_locale' => 'en_US',
  'default_phone_region' => 'US',
  'maintenance' => false,
  'app_install_overwrite' => 
  array (
    0 => 'user_saml',
    1 => 'sharelisting',
    2 => 'files_trackdownloads',
    3 => 'workflow_script',
    4 => 'backup',
    5 => 'documentserver_community',
    6 => 'activitylog',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxxxxxxxxx',
  'mail_domain' => 'xxxxxxxxxx',
  'mail_smtphost' => 'smtp.office365.com',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxxxxxxxx',
  'mail_smtppassword' => 'xxxxxxxxxx',
  'mail_smtpauthtype' => 'LOGIN',
  'theme' => '',
);

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

I cleared the logfile and rebooted. Tried to access NC via URL
nextcloud.access

67.164.171.117 - - [15/Nov/2022:19:15:49 +0000] “GET / HTTP/1.1” 500 301 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
67.164.171.117 - - [15/Nov/2022:19:15:49 +0000] “GET /favicon.ico HTTP/1.1” 500 301 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
67.164.171.117 - - [15/Nov/2022:19:15:52 +0000] “GET / HTTP/1.1” 500 301 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
67.164.171.117 - - [15/Nov/2022:19:15:53 +0000] “GET / HTTP/1.1” 500 301 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
67.164.171.117 - - [15/Nov/2022:19:15:54 +0000] “GET / HTTP/1.1” 500 301 “-” “Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”

nextcloud.error

NO ENTRIES

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.

I cleared the logfile and rebooted. Tried to access NC via URL
nextcloud.log

NO ENTRIES

Ok, figured it out. Dumb error on my part… When I created the new LightSail SQL instance from a snapshot, I needed to provide a dbname, which must be unique across AWS. That’s a bit misleading, as SQL still knows it as my original dbname. All I had to do was change the config file dbhost entry, not both dbname and dbhost.