Error sending query packet

Nextcloud version (eg, 18.0.2):
Operating system and version (eg, Ubuntu 20.04): Raspbian buster 10
Apache or nginx version (eg, Apache 2.4.25): 2.4.38
PHP version (eg, 7.1): 7.3

The issue you are facing:

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

Steps to replicate it:

Not too sure but I’m getting a lot of these errors and I’m using the auto upload feature on the android app so it probably has something to do with that.

The output of your Nextcloud log in Admin > Logging:

Error	PHP 	Error: Error while sending QUERY packet. PID=3712 at /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php#78

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

[Fri Dec 04 00:23:10.774634 2020] [php7:error] [pid 3223] [client] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused in /var/www/nextcloud/...

That is the issue. Please check your database connection.