An exception occurred while executing a query sqlstate[HY000] general error: 2006 MySQL server has gone away

Nextcloud version (eg, 20.0.5): Nextcloud Hub 5 (27.0.2)
Operating system and version (eg, Ubuntu 20.04): 22.04.3 LTS (Jammy Jellyfish)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.58 (Ubuntu)
PHP version (eg, 7.4): PHP 8.2.12 (cli) (built: Oct 26 2023 17:33:49) (NTS)

The issue you are facing:

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

Steps to replicate it:

  1. Upload a bit bigger file like 10MB
  2. It will come up during upload and the file will not be uploaded

The output of your Nextcloud log in Admin > Logging:

Error	no app in context	Doctrine\DBAL\Exception\ConnectionLost: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Error	webdav	Sabre\DAV\Exception: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Error	webdav	Doctrine\DBAL\Exception\ConnectionLost: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away		2023-11-22T16:14:25+0700
Error	no app in context	Sabre\DAV\Exception\BadRequest: Expected filesize of 10485760 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8560640 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

After has a huge amount of brute force stuff, I think when multiple file drag and dropped:

Error	index	OCP\Security\Bruteforce\MaxDelayReached: Reached maximum delay		2023-11-22T16:28:00+0700
Error	index	OCP\Security\Bruteforce\MaxDelayReached: Reached maximum delay		2023-11-22T16:28:00+0700
Error	index	OCP\Security\Bruteforce\MaxDelayReached: Reached maximum delay

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

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
    2 => '',
  ),
  'datadirectory' => '/nextcloud_data',
  'overwrite.cli.url' => 'https://nextcloudxxxx/',
  'overwritehost' => 'nextcloudxxxx',
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'xxxx:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'xxu',
  'installed' => true,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'lost_password_link' => 'disabled',
  'default_language' => 'en',
  'allow_user_to_change_mail_address' => '',
  'logtimezone' => 'xxx',
  'memcache.local' => 'OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/nextcloud/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),
  'ldapUserCleanupInterval' => 51,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'loglevel' => 2,
  'debug' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'xxxx:25',
  'has_internet_connection' => false,
  'auth.webauthn.enabled' => false,
  'default_phone_region' => 'xx',
  'maintenance' => false,
);

Look here:

Much luck,
ernolf

In my case this value is 256MB, let me try with 1GB then.

Not really fixed, still occurs.