Stuck at "Watinig for MySQL."

Hello everyone,

I started facing this issue after using nextcloud on my Ubuntu 22.04 running old MacBookPro. This machine is my home server and is ever turned down, and every once in a while the nextcloud stops and won’t start back up. I think the main issue is that the mysql of the snap installation doesn’t come back up and the rest of the system is stuck waiting for it.

oldmac nextcloud $ sudo snap restart nextcloud
[sudo] password for otb: 
2022-11-28T08:07:40-05:00 INFO Waiting for "snap.nextcloud.mysql.service" to stop.
Restarted.
oldmac nextcloud $ sudo snap logs nextcloud
2022-11-28T08:07:41-05:00 systemd[1]: snap.nextcloud.renew-certs.service: Consumed 1.740s CPU time.
2022-11-28T08:07:41-05:00 systemd[1]: Started Service for snap application nextcloud.renew-certs.
2022-11-28T08:07:41-05:00 nextcloud.redis-server[51652]: 51652:C 28 Nov 2022 08:07:41.820 # Reading config from stdin
2022-11-28T08:07:42-05:00 nextcloud.mysql[51291]: . *
2022-11-28T08:07:42-05:00 nextcloud.mysql[51163]: Waiting for MySQL...
2022-11-28T08:07:43-05:00 nextcloud.renew-certs[51696]: Saving debug log to /var/snap/nextcloud/current/certs/certbot/logs/letsencrypt.log
2022-11-28T08:07:43-05:00 nextcloud.renew-certs[51696]: 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2022-11-28T08:07:43-05:00 nextcloud.renew-certs[51696]: No renewals were attempted.
2022-11-28T08:07:43-05:00 nextcloud.renew-certs[51696]: No hooks were run.
2022-11-28T08:07:43-05:00 nextcloud.renew-certs[51696]: 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
oldmac nextcloud $ sudo snap logs nextcloud.mysql
2022-11-28T08:07:39-05:00 systemd[1]: Stopping Service for snap application nextcloud.mysql...
2022-11-28T08:07:39-05:00 nextcloud.mysql[50986]: Shutting down MySQL
2022-11-28T08:07:41-05:00 nextcloud.mysql[50986]: .. *
2022-11-28T08:07:41-05:00 systemd[1]: snap.nextcloud.mysql.service: Deactivated successfully.
2022-11-28T08:07:41-05:00 systemd[1]: Stopped Service for snap application nextcloud.mysql.
2022-11-28T08:07:41-05:00 systemd[1]: snap.nextcloud.mysql.service: Consumed 19.588s CPU time.
2022-11-28T08:07:41-05:00 systemd[1]: Started Service for snap application nextcloud.mysql.
2022-11-28T08:07:41-05:00 nextcloud.mysql[51291]: Starting MySQL
2022-11-28T08:07:42-05:00 nextcloud.mysql[51291]: . *
2022-11-28T08:07:42-05:00 nextcloud.mysql[51163]: Waiting for MySQL...

In the past I was able to get it to initialize just once by fiddling with the permissions of some of the files with chmod thinking that it wasn’t able to read the password for the database or something, but that doesn’t work now. nothing helps, whether I restart the computer or the services individiually, nextcloud won’t come online.

Any help is appreciated.

My config (I haven’t touched it, it should be as it is the first day I installed from snap):

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'instanceid' => '1234512345',
  'passwordsalt' => '1234512345',
  'secret' => '1234512345',
 'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.0.14',
    2 => '192.168.0.*',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.6.1',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '1234512345',
  'installed' => true,
  'maintenance' => false,
);