Nextcloud Failed to connect to the database: An exception occurred in driver

Log in to nextcloud, and find that the capacity of the group folder is displayed as waiting, and check the logs to find that the connection to MySQL is abnormal

{“reqId”:“2dSdGey4m8mbWL06X67N”,“level”:3,“time”:“2023-01-03T08:28:06+00:00”,“remoteAddr”:“120.244.220.201”,“user”:“–”,“app”:“index”,“method”:“POST”,“url”:“/apps/text/session/sync”,“message”:{“Exception”:“Doctrine\DBAL\DBALException”,“Message”:“Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away”,“Code”:0,“Trace”:[{“file”:“/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php”,“line”:1449,“function”:“connect”,“class”:“OC\DB\Connection”,“type”:“->”,“args”:},{“file”:“/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php”,“line”:892,“function”:“getWrappedConnection”,“class”:“Doctrine\DBAL\Connection”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/private/DB/Connection.php”,“line”:202,“function”:“executeQuery”,“class”:“Doctrine\DBAL\Connection”,“type”:“->”,“args”:[“SELECT * FROM oc_appconfig”,,,null]},{“file”:“/var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php”,“line”:206,“function”:“executeQuery”,“class”:“OC\DB\Connection”,“type”:“->”,“args”:[“SELECT * FROM oc_appconfig”,,]},{“file”:“/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php”,“line”:217,“function”:“execute”,“class”:“Doctrine\DBAL\Query\QueryBuilder”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/private/AppConfig.php”,“line”:345,“function”:“execute”,“class”:“OC\DB\QueryBuilder\QueryBuilder”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/private/AppConfig.php”,“line”:110,“function”:“loadConfigValues”,“class”:“OC\AppConfig”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/private/AppConfig.php”,“line”:301,“function”:“getApps”,“class”:“OC\AppConfig”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/private/legacy/OC_App.php”,“line”:949,“function”:“getValues”,“class”:“OC\AppConfig”,“type”:“->”,“args”:[false,“installed_version”]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:668,“function”:“getAppVersions”,“class”:“OC_App”,“type”:“::”,“args”:},{“file”:“/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php”,“line”:155,“function”:“OC\{closure}”,“class”:“OC\Server”,“type”:“->”,“args”:[“*** sensitive parameters replaced “]},{“file”:”/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php",“line”:118,“function”:“OC\AppFramework\Utility\{closure}”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[" sensitive parameters replaced “]},{“file”:”/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",“line”:122,“function”:“offsetGet”,“class”:“Pimple\Container”,“type”:“->”,“args”:[“OC\Memcache\Factory”]},{“file”:“/var/www/html/lib/private/ServerContainer.php”,“line”:156,“function”:“query”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[“OC\Memcache\Factory”,true]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:1677,“function”:“query”,“class”:“OC\ServerContainer”,“type”:“->”,“args”:[“OC\Memcache\Factory”]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:1017,“function”:“getMemCacheFactory”,“class”:“OC\Server”,“type”:“->”,“args”:[]},{“file”:“/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php”,“line”:155,“function”:“OC\{closure}”,“class”:“OC\Server”,“type”:“->”,“args”:[" sensitive parameters replaced “]},{“file”:”/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php",“line”:118,“function”:“OC\AppFramework\Utility\{closure}”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[" sensitive parameters replaced “]},{“file”:”/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php",“line”:122,“function”:“offsetGet”,“class”:“Pimple\Container”,“type”:“->”,“args”:[“OCP\Lock\ILockingProvider”]},{“file”:“/var/www/html/lib/private/ServerContainer.php”,“line”:156,“function”:“query”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[“OCP\Lock\ILockingProvider”,true]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:1977,“function”:“query”,“class”:“OC\ServerContainer”,“type”:“->”,“args”:[“OCP\Lock\ILockingProvider”]},{“file”:“/var/www/html/lib/private/Files/View.php”,“line”:118,“function”:“getLockingProvider”,“class”:“OC\Server”,“type”:“->”,“args”:[]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:395,“function”:“__construct”,“class”:“OC\Files\View”,“type”:“->”,“args”:[]},{“file”:“/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php”,“line”:155,“function”:“OC\{closure}”,“class”:“OC\Server”,“type”:“->”,“args”:[" sensitive parameters replaced “]},{“file”:”/var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php",“line”:118,“function”:“OC\AppFramework\Utility\{closure}”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[" sensitive parameters replaced ***”]},{“file”:“/var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php”,“line”:122,“function”:“offsetGet”,“class”:“Pimple\Container”,“type”:“->”,“args”:[“OC\Files\Node\HookConnector”]},{“file”:“/var/www/html/lib/private/ServerContainer.php”,“line”:156,“function”:“query”,“class”:“OC\AppFramework\Utility\SimpleContainer”,“type”:“->”,“args”:[“OC\Files\Node\HookConnector”,true]},{“file”:“/var/www/html/lib/private/Server.php”,“line”:1324,“function”:“query”,“class”:“OC\ServerContainer”,“type”:“->”,“args”:[“OC\Files\Node\HookConnector”]},{“file”:“/var/www/html/lib/base.php”,“line”:595,“function”:“boot”,“class”:“OC\Server”,“type”:“->”,“args”:},{“file”:“/var/www/html/lib/base.php”,“line”:1091,“function”:“init”,“class”:“OC”,“type”:“::”,“args”:},{“file”:“/var/www/html/index.php”,“line”:35,“args”:[“/var/www/html/lib/base.php”],“function”:“require_once”}],“File”:“/var/www/html/lib/private/DB/Connection.php”,“Line”:72,“CustomMessage”:“–”},“userAgent”:“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36”,“version”:“20.0.10.1”}