Nextcloud 26.0.2-ls246 fails to connect to database after power outage

Hello friends, we recently suffered a power outage and a bunch of my services on the ole home server got broken, I’ve managed to fix everything so far but I’m stuck trying to get nextcloud working again, some information below:

OS: Ubuntu server 22.04.4
Docker version: 25.0.3
Nextcloud image: linuxserver/nextcloud:26.0.2-ls246
MySQL image: linuxserver/mysql:latest
Machine is a dell power edge t420, with a hardware raid 5.

MySQL logs:

*** Running /etc/my_init.d/999_advanced_script.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 31
tail: unrecognized file system type 0x794c7630 for ‘/var/log/syslog’. please report this to bug-coreutils@gnu.org. reverting to polling
240225 20:44:30 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 20:44:30 mysqld_safe Starting mysqld daemon with databases from /config/databases
Feb 25 20:44:30 fc4240abade9 syslog-ng[37]: syslog-ng starting up; version='3.5.3'
Feb 25 21:17:01 fc4240abade9 /USR/SBIN/CRON[539]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
*** Shutting down runit daemon (PID 31)...
*** Killing all processes...
Could not open required defaults file: /etc/mysql/debian.cnf
Fatal error in defaults handling. Program aborted
240225 22:07:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_add_user_abc.sh...
-------------------------------------
          _     _ _
         | |___| (_) ___
         | / __| | |/ _ \ 
         | \__ \ | | (_) |
         |_|___/ |_|\___/
               |_|
Brought to you by linuxserver.io
We do accept donations at:
https://www.linuxserver.io/donations
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------
*** Running /etc/my_init.d/20_apt_update.sh...
*** Running /etc/my_init.d/30_config.sh...
*** Running /etc/my_init.d/40_set_up_dbase.sh...
*** Running /etc/my_init.d/999_advanced_script.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 31
tail: unrecognized file system type 0x794c7630 for ‘/var/log/syslog’. please report this to bug-coreutils@gnu.org. reverting to polling
240225 22:07:08 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 22:07:08 mysqld_safe Starting mysqld daemon with databases from /config/databases
Feb 25 22:07:08 fc4240abade9 syslog-ng[37]: syslog-ng starting up; version='3.5.3'
Feb 25 22:17:01 fc4240abade9 /USR/SBIN/CRON[539]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
*** Shutting down runit daemon (PID 31)...
*** Killing all processes...
Could not open required defaults file: /etc/mysql/debian.cnf
Fatal error in defaults handling. Program aborted
240225 22:20:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/10_add_user_abc.sh...
-------------------------------------
          _     _ _
         | |___| (_) ___
         | / __| | |/ _ \ 
         | \__ \ | | (_) |
         |_|___/ |_|\___/
               |_|
Brought to you by linuxserver.io
We do accept donations at:
https://www.linuxserver.io/donations
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------
*** Running /etc/my_init.d/20_apt_update.sh...
*** Running /etc/my_init.d/30_config.sh...
*** Running /etc/my_init.d/40_set_up_dbase.sh...
*** Running /etc/my_init.d/999_advanced_script.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 31
tail: unrecognized file system type 0x794c7630 for ‘/var/log/syslog’. please report this to bug-coreutils@gnu.org. reverting to polling
240225 22:20:37 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 22:20:37 mysqld_safe Starting mysqld daemon with databases from /config/databases
Feb 25 22:20:37 fc4240abade9 syslog-ng[37]: syslog-ng starting up; version='3.5.3'
Feb 25 23:17:01 fc4240abade9 /USR/SBIN/CRON[539]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 00:17:01 fc4240abade9 /USR/SBIN/CRON[542]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 01:17:01 fc4240abade9 /USR/SBIN/CRON[545]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 02:17:01 fc4240abade9 /USR/SBIN/CRON[548]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 03:17:01 fc4240abade9 /USR/SBIN/CRON[551]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 04:17:01 fc4240abade9 /USR/SBIN/CRON[554]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 05:17:01 fc4240abade9 /USR/SBIN/CRON[557]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 06:17:01 fc4240abade9 /USR/SBIN/CRON[560]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 06:25:01 fc4240abade9 /USR/SBIN/CRON[563]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
tail: ‘/var/log/syslog’ has been replaced;  following end of new file
Feb 26 06:25:26 fc4240abade9 syslog-ng[37]: Configuration reload request received, reloading configuration;
Feb 26 06:25:26 fc4240abade9 syslog-ng[37]: Configuration reload request received, reloading configuration;
Feb 26 06:25:26 fc4240abade9 /USR/SBIN/CRON[562]: (CRON) info (No MTA installed, discarding output)
Feb 26 07:17:01 fc4240abade9 /USR/SBIN/CRON[633]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 08:17:01 fc4240abade9 /USR/SBIN/CRON[636]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 26 09:17:01 fc4240abade9 /USR/SBIN/CRON[639]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

MySQL error log from /config/log/mysql/error.log:


Version: '5.5.58-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
231007  9:59:18 [Warning] IP address '172.17.0.1' could not be resolved: Name or service not known
240225 17:59:39 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 17:59:39 mysqld_safe Starting mysqld daemon with databases from /config/databases
240225 17:59:41 [Note] /usr/sbin/mysqld (mysqld 5.5.58-0ubuntu0.14.04.1) starting as process 523 ...
240225 17:59:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 17:59:42 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 17:59:42 [Note] Plugin 'FEDERATED' is disabled.
240225 17:59:42 InnoDB: The InnoDB memory heap is disabled
240225 17:59:42 InnoDB: Mutexes and rw_locks use GCC atomic builtins
240225 17:59:42 InnoDB: Compressed tables use zlib 1.2.8
240225 17:59:42 InnoDB: Using Linux native AIO
240225 17:59:42 InnoDB: Initializing buffer pool, size = 128.0M
240225 17:59:42 InnoDB: Completed initialization of buffer pool
240225 17:59:42 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
240225 17:59:42  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
240225 17:59:45  InnoDB: Waiting for the background threads to start
240225 17:59:46 InnoDB: 5.5.58 started; log sequence number 9518634234
240225 17:59:46 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
240225 17:59:46 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
240225 17:59:46 [Note] Server socket created on IP: '0.0.0.0'.
240225 17:59:46 [Note] Event Scheduler: Loaded 0 events
240225 17:59:46 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.58-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
240225 20:44:28 [Note] /usr/sbin/mysqld: Normal shutdown

240225 20:44:28 [Note] Event Scheduler: Purging the queue. 0 events
240225 20:44:28  InnoDB: Starting shutdown...
240225 20:44:29  InnoDB: Shutdown completed; log sequence number 9518634234
240225 20:44:29 [Note] /usr/sbin/mysqld: Shutdown complete

240225 20:44:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
240225 20:44:30 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 20:44:30 mysqld_safe Starting mysqld daemon with databases from /config/databases
240225 20:44:30 [Note] /usr/sbin/mysqld (mysqld 5.5.58-0ubuntu0.14.04.1) starting as process 520 ...
240225 20:44:30 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 20:44:30 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 20:44:30 [Note] Plugin 'FEDERATED' is disabled.
240225 20:44:30 InnoDB: The InnoDB memory heap is disabled
240225 20:44:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins
240225 20:44:30 InnoDB: Compressed tables use zlib 1.2.8
240225 20:44:30 InnoDB: Using Linux native AIO
240225 20:44:30 InnoDB: Initializing buffer pool, size = 128.0M
240225 20:44:30 InnoDB: Completed initialization of buffer pool
240225 20:44:30 InnoDB: highest supported file format is Barracuda.
240225 20:44:30  InnoDB: Waiting for the background threads to start
240225 20:44:31 InnoDB: 5.5.58 started; log sequence number 9518634234
240225 20:44:31 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
240225 20:44:31 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
240225 20:44:31 [Note] Server socket created on IP: '0.0.0.0'.
240225 20:44:31 [Note] Event Scheduler: Loaded 0 events
240225 20:44:31 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.58-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
240225 22:07:06 [Note] /usr/sbin/mysqld: Normal shutdown

240225 22:07:06 [Note] Event Scheduler: Purging the queue. 0 events
240225 22:07:06  InnoDB: Starting shutdown...
240225 22:07:07  InnoDB: Shutdown completed; log sequence number 9518634234
240225 22:07:07 [Note] /usr/sbin/mysqld: Shutdown complete

240225 22:07:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
240225 22:07:08 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 22:07:08 mysqld_safe Starting mysqld daemon with databases from /config/databases
240225 22:07:08 [Note] /usr/sbin/mysqld (mysqld 5.5.58-0ubuntu0.14.04.1) starting as process 520 ...
240225 22:07:08 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 22:07:08 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 22:07:08 [Note] Plugin 'FEDERATED' is disabled.
240225 22:07:08 InnoDB: The InnoDB memory heap is disabled
240225 22:07:08 InnoDB: Mutexes and rw_locks use GCC atomic builtins
240225 22:07:08 InnoDB: Compressed tables use zlib 1.2.8
240225 22:07:08 InnoDB: Using Linux native AIO
240225 22:07:08 InnoDB: Initializing buffer pool, size = 128.0M
240225 22:07:08 InnoDB: Completed initialization of buffer pool
240225 22:07:08 InnoDB: highest supported file format is Barracuda.
240225 22:07:08  InnoDB: Waiting for the background threads to start
240225 22:07:09 InnoDB: 5.5.58 started; log sequence number 9518634234
240225 22:07:09 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
240225 22:07:09 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
240225 22:07:09 [Note] Server socket created on IP: '0.0.0.0'.
240225 22:07:09 [Note] Event Scheduler: Loaded 0 events
240225 22:07:09 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.58-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
240225 22:20:14 [Note] /usr/sbin/mysqld: Normal shutdown

240225 22:20:14 [Note] Event Scheduler: Purging the queue. 0 events
240225 22:20:14  InnoDB: Starting shutdown...
240225 22:20:15  InnoDB: Shutdown completed; log sequence number 9518634234
240225 22:20:15 [Note] /usr/sbin/mysqld: Shutdown complete

240225 22:20:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
240225 22:20:37 mysqld_safe Logging to '/config/log/mysql/error.log'.
240225 22:20:37 mysqld_safe Starting mysqld daemon with databases from /config/databases
240225 22:20:37 [Note] /usr/sbin/mysqld (mysqld 5.5.58-0ubuntu0.14.04.1) starting as process 520 ...
240225 22:20:37 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 22:20:37 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
240225 22:20:37 [Note] Plugin 'FEDERATED' is disabled.
240225 22:20:37 InnoDB: The InnoDB memory heap is disabled
240225 22:20:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
240225 22:20:37 InnoDB: Compressed tables use zlib 1.2.8
240225 22:20:37 InnoDB: Using Linux native AIO
240225 22:20:37 InnoDB: Initializing buffer pool, size = 128.0M
240225 22:20:37 InnoDB: Completed initialization of buffer pool
240225 22:20:37 InnoDB: highest supported file format is Barracuda.
240225 22:20:41  InnoDB: Waiting for the background threads to start
240225 22:20:42 InnoDB: 5.5.58 started; log sequence number 9518634234
240225 22:20:42 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
240225 22:20:42 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
240225 22:20:42 [Note] Server socket created on IP: '0.0.0.0'.
240225 22:20:42 [Note] Event Scheduler: Loaded 0 events
240225 22:20:42 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.5.58-0ubuntu0.14.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
240226 10:03:21 [Warning] IP address '192.168.1.64' could not be resolved: Name or service not known

Nextcloud logs:

Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Host is unreachable in /config/www/nextcloud/lib/private/DB/Connection.php:140
\00\00\00\00\00\00
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1531): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1029): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /config/www/nextcloud/lib/private/DB/Connection.php(262): Doctrine\DBAL\Connection->executeQuery()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()
#4 /config/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /config/www/nextcloud/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /config/www/nextcloud/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#7 /config/www/nextcloud/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#8 /config/www/nextcloud/lib/private/legacy/OC_App.php(976): OC\AppConfig->getValues()
#9 /config/www/nextcloud/lib/private/Server.php(729): OC_App::getAppVersions()
#10 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#11 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#13 /config/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#14 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#15 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(193): OC\AppFramework\Utility\SimpleContainer->get()
#16 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#17 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#19 /config/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#20 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#21 /config/www/nextcloud/lib/private/Server.php(1110): OC\AppFramework\Utility\SimpleContainer->get()
#22 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#23 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#24 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#25 /config/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#26 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#27 /config/www/nextcloud/lib/private/Server.php(2065): OC\AppFramework\Utility\SimpleContainer->get()
#28 /config/www/nextcloud/lib/private/Files/View.php(119): OC\Server->getLockingProvider()
#29 /config/www/nextcloud/lib/private/Server.php(464): OC\Files\View->__construct()
#30 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC\{closure}()
#31 /config/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#32 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()
#33 /config/www/nextcloud/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()
#34 /config/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()
#35 /config/www/nextcloud/lib/private/Server.php(1467): OC\AppFramework\Utility\SimpleContainer->get()
#36 /config/www/nextcloud/lib/base.php(625): OC\Server->boot()
#37 /config/www/nextcloud/lib/base.php(1167): OC::init()
#38 /config/www/nextcloud/cron.php(43): require_once('...')
#39 {main}

If i need to provide any further information please let me know.
Thank you kindly for any help

I would try a Mariadb repair, if that fails, restore a db backup.

Most importantly, look into a battery backup and/or generator. Don’t let your server uncleanly shutdown.

Thank you for your tip driz, i executed into the Mysql container and ran
mysqlcheck -A --auto-repair -u root -p
However this just returned that all the databases were ok as shown in text below:

root@fc4240abade9:/# sudo mysqlcheck --all-databases -u root -p
Enter password: 
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
nextcloud.oc_accounts                              OK
nextcloud.oc_accounts_data                         OK
nextcloud.oc_activity                              OK
nextcloud.oc_activity_mq                           OK
nextcloud.oc_addressbookchanges                    OK
nextcloud.oc_addressbooks                          OK
nextcloud.oc_appconfig                             OK
nextcloud.oc_authorized_groups                     OK
nextcloud.oc_authtoken                             OK
nextcloud.oc_bruteforce_attempts                   OK
nextcloud.oc_calendar_appt_bookings                OK
nextcloud.oc_calendar_appt_configs                 OK
nextcloud.oc_calendar_invitations                  OK
nextcloud.oc_calendar_reminders                    OK
nextcloud.oc_calendar_resources                    OK
nextcloud.oc_calendar_resources_md                 OK
nextcloud.oc_calendar_rooms                        OK
nextcloud.oc_calendar_rooms_md                     OK
nextcloud.oc_calendarchanges                       OK
nextcloud.oc_calendarobjects                       OK
nextcloud.oc_calendarobjects_props                 OK
nextcloud.oc_calendars                             OK
nextcloud.oc_calendarsubscriptions                 OK
nextcloud.oc_cards                                 OK
nextcloud.oc_cards_properties                      OK
nextcloud.oc_circles_circle                        OK
nextcloud.oc_circles_event                         OK
nextcloud.oc_circles_member                        OK
nextcloud.oc_circles_membership                    OK
nextcloud.oc_circles_mount                         OK
nextcloud.oc_circles_mountpoint                    OK
nextcloud.oc_circles_remote                        OK
nextcloud.oc_circles_share_lock                    OK
nextcloud.oc_circles_token                         OK
nextcloud.oc_collres_accesscache                   OK
nextcloud.oc_collres_collections                   OK
nextcloud.oc_collres_resources                     OK
nextcloud.oc_comments                              OK
nextcloud.oc_comments_read_markers                 OK
nextcloud.oc_dav_cal_proxy                         OK
nextcloud.oc_dav_shares                            OK
nextcloud.oc_direct_edit                           OK
nextcloud.oc_directlink                            OK
nextcloud.oc_federated_reshares                    OK
nextcloud.oc_file_locks                            OK
nextcloud.oc_file_metadata                         OK
nextcloud.oc_filecache                             OK
nextcloud.oc_filecache_extended                    OK
nextcloud.oc_files_trash                           OK
nextcloud.oc_files_versions                        OK
nextcloud.oc_flow_checks                           OK
nextcloud.oc_flow_operations                       OK
nextcloud.oc_flow_operations_scope                 OK
nextcloud.oc_group_admin                           OK
nextcloud.oc_group_user                            OK
nextcloud.oc_groups                                OK
nextcloud.oc_jobs                                  OK
nextcloud.oc_known_users                           OK
nextcloud.oc_login_flow_v2                         OK
nextcloud.oc_migrations                            OK
nextcloud.oc_mimetypes                             OK
nextcloud.oc_mounts                                OK
nextcloud.oc_notes_meta                            OK
nextcloud.oc_notifications                         OK
nextcloud.oc_notifications_pushhash                OK
nextcloud.oc_notifications_settings                OK
nextcloud.oc_oauth2_access_tokens                  OK
nextcloud.oc_oauth2_clients                        OK
nextcloud.oc_open_local_editor                     OK
nextcloud.oc_passwords_challenge                   OK
nextcloud.oc_passwords_folder                      OK
nextcloud.oc_passwords_folder_rv                   OK
nextcloud.oc_passwords_keychain                    OK
nextcloud.oc_passwords_password                    OK
nextcloud.oc_passwords_password_rv                 OK
nextcloud.oc_passwords_pw_tag_rel                  OK
nextcloud.oc_passwords_registration                OK
nextcloud.oc_passwords_session                     OK
nextcloud.oc_passwords_share                       OK
nextcloud.oc_passwords_tag                         OK
nextcloud.oc_passwords_tag_rv                      OK
nextcloud.oc_photos_albums                         OK
nextcloud.oc_photos_albums_collabs                 OK
nextcloud.oc_photos_albums_files                   OK
nextcloud.oc_preferences                           OK
nextcloud.oc_privacy_admins                        OK
nextcloud.oc_profile_config                        OK
nextcloud.oc_properties                            OK
nextcloud.oc_ratelimit_entries                     OK
nextcloud.oc_reactions                             OK
nextcloud.oc_recent_contact                        OK
nextcloud.oc_schedulingobjects                     OK
nextcloud.oc_share                                 OK
nextcloud.oc_share_external                        OK
nextcloud.oc_storages                              OK
nextcloud.oc_storages_credentials                  OK
nextcloud.oc_systemtag                             OK
nextcloud.oc_systemtag_group                       OK
nextcloud.oc_systemtag_object_mapping              OK
nextcloud.oc_text_documents                        OK
nextcloud.oc_text_sessions                         OK
nextcloud.oc_text_steps                            OK
nextcloud.oc_trusted_servers                       OK
nextcloud.oc_twofactor_backupcodes                 OK
nextcloud.oc_twofactor_providers                   OK
nextcloud.oc_user_status                           OK
nextcloud.oc_user_transfer_owner                   OK
nextcloud.oc_users                                 OK
nextcloud.oc_vcategory                             OK
nextcloud.oc_vcategory_to_object                   OK
nextcloud.oc_webauthn                              OK
nextcloud.oc_whats_new                             OK
root@fc4240abade9:/#

To me this would suggest that the db is still in good shape but i just can’t reach it for some reason, any further assistance greatly appreciated.

share the compose for both mariadb and nextcloud as well as the db section (remove the password please) from your nextcloud config.php

I’ll start out by saying that I’ve now fixed the problem, I’ll explain how i did it a little further down.

While i don’t have the original docker compose handy for these two containers i used a tool (GitHub - Red5d/docker-autocompose: Generate a docker-compose yaml definition from a running container) to generate the following:

MySQL:

services:
  MySQL:

    cap_drop:
      - "AUDIT_CONTROL"
      - "BLOCK_SUSPEND"
      - "DAC_READ_SEARCH"
      - "IPC_LOCK"
      - "IPC_OWNER"
      - "LEASE"
      - "LINUX_IMMUTABLE"
      - "MAC_ADMIN"
      - "MAC_OVERRIDE"
      - "NET_ADMIN"
      - "NET_BROADCAST"
      - "SYSLOG"
      - "SYS_ADMIN"
      - "SYS_BOOT"
      - "SYS_MODULE"
      - "SYS_NICE"
      - "SYS_PACCT"
      - "SYS_PTRACE"
      - "SYS_RAWIO"
      - "SYS_RESOURCE"
      - "SYS_TIME"
      - "SYS_TTY_CONFIG"
      - "WAKE_ALARM"

    command:
      - "/sbin/my_init"

    container_name: "MySQL"

    environment:
      - "DATADIR=/config/databases"
      - "DEBIAN_FRONTEND=noninteractive"
      - "HOME=/root"
      - "INSTALL_LIST=mysql-server mysqltuner"
      - "MYSQL_DIR=/config"
      - "MYSQL_ROOT_PASSWORD=REDACTED"
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "PGID=1000"
      - "PUID=1000"
      - "TERM=xterm"

    hostname: "fc4240abade9"

    image: "linuxserver/mysql:latest"

    ipc: "private"

    labels:
      build_version: "Linuxserver.io version:- 79 Build-date:- January-12-2018-16:29:31-UTC"

    logging:
      driver: "json-file"
      options: {}

    mac_address: "02:42:ac:11:00:0a"

    network_mode: "bridge"

    ports:
      - "3306:3306/tcp"

    restart: "unless-stopped"

    volumes:
      - "/home/artur/mysql/config:/config"

version: "3.6"

and

Nextcloud

services:
  Nextcloud:

    cap_drop:
      - "AUDIT_CONTROL"
      - "BLOCK_SUSPEND"
      - "DAC_READ_SEARCH"
      - "IPC_LOCK"
      - "IPC_OWNER"
      - "LEASE"
      - "LINUX_IMMUTABLE"
      - "MAC_ADMIN"
      - "MAC_OVERRIDE"
      - "NET_ADMIN"
      - "NET_BROADCAST"
      - "SYSLOG"
      - "SYS_ADMIN"
      - "SYS_BOOT"
      - "SYS_MODULE"
      - "SYS_NICE"
      - "SYS_PACCT"
      - "SYS_PTRACE"
      - "SYS_RAWIO"
      - "SYS_RESOURCE"
      - "SYS_TIME"
      - "SYS_TTY_CONFIG"
      - "WAKE_ALARM"

    container_name: "Nextcloud"

    entrypoint:
      - "/init"

    environment:
      - "HOME=/root"
      - "LD_PRELOAD=/usr/lib/preloadable_libiconv.so"
      - "NEXTCLOUD_PATH=/config/www/nextcloud"
      - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
      - "PGID=1000"
      - "PS1=$(whoami)@$(hostname):$(pwd)\\$"
      - "PUID=1000"
      - "S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0"
      - "TERM=xterm"
      - "TZ=Europe/Stockholm"
      - "S6_VERBOSITY=1"
      - "S6_STAGE2_HOOK=/docker-mods"
      - "VIRTUAL_ENV=/lsiopy"
      - "LSIO_FIRST_PARTY=true"

    hostname: "86123820697a"

    image: "linuxserver/nextcloud:26.0.2-ls246"

    ipc: "private"

    labels:
      build_version: "Linuxserver.io version:- 25.0.2-ls213 Build-date:- 2022-12-08T17:21:47+01:00"
      maintainer: "aptalca"
      org.opencontainers.image.authors: "linuxserver.io"
      org.opencontainers.image.created: "2022-12-08T17:21:47+01:00"
      org.opencontainers.image.description: "[Nextcloud](https://nextcloud.com/) gives you access to all\
        \ your files wherever you are.    Where are your photos and documents? With Nextcloud you pick\
        \ a server of your choice, at home, in a data center or at a provider. And that is where your\
        \ files will be. Nextcloud runs on that server, protecting your data and giving you access from\
        \ your desktop or mobile devices. Through Nextcloud you also access, sync and share your existing\
        \ data on that FTP drive at the office, a Dropbox or a NAS you have at home.  "
      org.opencontainers.image.documentation: "https://docs.linuxserver.io/images/docker-nextcloud"
      org.opencontainers.image.licenses: "GPL-3.0-only"
      org.opencontainers.image.ref.name: "90d2da1cd5a0f1be94cf0059939feb76bf1bf386"
      org.opencontainers.image.revision: "90d2da1cd5a0f1be94cf0059939feb76bf1bf386"
      org.opencontainers.image.source: "https://github.com/linuxserver/docker-nextcloud"
      org.opencontainers.image.title: "Nextcloud"
      org.opencontainers.image.url: "https://github.com/linuxserver/docker-nextcloud/packages"
      org.opencontainers.image.vendor: "linuxserver.io"
      org.opencontainers.image.version: "25.0.2-ls213"

    logging:
      driver: "json-file"
      options: {}

    mac_address: "02:42:ac:11:00:03"

    network_mode: "bridge"

    ports:
      - "4443:443/tcp"

    restart: "unless-stopped"

    volumes:
      - "/home/artur/nextcloud/config:/config"
      - "/home/artur/nextcloud/data:/data"

    working_dir: "/"

version: "3.6"

While i was searching for and through the config.php for Nextcloud i noticed the IP addresses in the file did not match the actual ip of the server (as part of recovery after the power outage i was forced to reset my gateway so some IP addresses got shifted around), i changed these values manually and nextcloud started working again.

Original config.php

<?php
  'trusted_domains' => 
  array (
    0 => '192.168.1.7',
  ),
  'dbtype' => 'mysql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://192.168.1.7',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.7:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_artur',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
  'theme' => '',
);

Fixed config.php

<?php
  'trusted_domains' => 
  array (
    0 => '192.168.1.27',
  ),
  'dbtype' => 'mysql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://192.168.1.27',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.1.27:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_artur',
  'dbpassword' => 'REDACTED,
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
  'theme' => '',
);

Thank you driz for setting me on the right path to fix the issue :slight_smile:

as a note, you are double natting between your db and nextcloud and it’s extremely inefficient. the proper way to do this is to share a custom bridge between nc and the db, then dbhost would be the container_name of the db. I suspect you are using some UI which we do not support to manage things and that was the cause of your issue and subsequently your double nat.

right now, it’s you → docker host → nat to bridge → nextcloud → nat to host → nat to bridge → database → nat to host → nat to bridge → nextcloud

using a shared custom bridge will give you
you → docker host → nat to bridge → nextcloud → db → nextcloud

I am using portainer, i am pretty sure i would be able to set up the custom bridge in portainer but i created these containers over a year ago when i was very inexperienced and since they’ve been running I’ve abided by the “if it works don’t fix it” rule, I’ll look into what you mentioned with the custom network bridge thank you for the tip.

i figured you were, we do not support or recommend portainer at all, unless you’re an expert. It causes way too many issues and is why many of the popular container makers dont support it.