[root@nethserver config]# occ migrations:migrate core
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
In MigrationService.php line 429:
Database error when running migration latest for app core
In ExceptionConverter.php line 101:
An exception occurred while executing a query: An exception occurred while executin
g a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In ExceptionConverter.php line 101:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006
MySQL server has gone away
In Exception.php line 26:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In Connection.php line 82:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
migrations:migrate <app> [<version>]
[root@nethserver config]# occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are ava
ilable
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Turned on maintenance mode
Repair error: An exception occurred while executing a query: An exception occurred while
executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Repair error: Failed to connect to the database: An exception occurred in the driver: SQ
LSTATE[HY000] [2002] Connection refused
Updating database schema
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the
driver: SQLSTATE[HY000] [2002] Connection refused
Update failed
Maintenance mode is kept active
Resetting log level
The database request takes too long and therefore the MySQL server times out. It’s also possible that the server is dropping a packet that is too large. Please refer to the manual of your database for how to raise the configuration options wait_timeout and/or max_allowed_packet.
Some shared hosters are not allowing the access to these config options. For such systems Nextcloud is providing a dbdriveroptions configuration option within your config/config.php where you can pass such options to the database driver. Please refer to Configuration Parameters for an example.
I could change the values for wait_timeout and max_allowed_packet to their maximum:
MariaDB [(none)]> show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 50000 |
+---------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> show variables like 'max_allowed_packet';
+--------------------+------------+
| Variable_name | Value |
+--------------------+------------+
| max_allowed_packet | 1073741824 |
+--------------------+------------+
1 row in set (0.00 sec)
Trying to do the update leads to the same error-messages:
Update vorbereiten
Log-Level auf "debug" gesetzt
Wartungsmodus eingeschaltet
Reparaturschritt: Repair MySQL collation
Reparaturinformation: All tables already have the correct collation -> nothing to do
Reparaturschritt: Repair SQLite autoincrement
Reparaturschritt: Copy data from accounts table when migrating from ownCloud
Reparaturfehler: An exception occurred while executing a query: An exception occurred while executing
a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Reparaturschritt: Drop account terms table when migrating from ownCloud
Reparaturfehler: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
Das Datenbankschema wird aktualisiert
Doctrine\DBAL\Exception: Failed to connect to the database:
An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused
And nothing seems to change, when I try to use the migrations scripts:
In MigrationService.php line 429:
Database error when running migration latest for app core
In ExceptionConverter.php line 101:
An exception occurred while executing a query: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In ExceptionConverter.php line 101:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In Exception.php line 26:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In Connection.php line 82:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
You can check if nextcloud mysql user has access to the database.
Can you share the settings:
grep 'db /usr/share/nextcloud/config/config.php |grep -v dbpass
/opt/rh/rh-mariadb105/root/bin/mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e 'SELECT user FROM mysql.user'
mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "SHOW GRANTS FOR 'nextcloud'@'localhost'"
Check if ‘dbpassword’ value in config.php is the same as the one from /var/lib/nethserver/secrets/nextcloud
The value for 'dbpassword' in config.php is the same as the one from /var/lib/nethserver/secrets/nextcloud.
nextcloud is in the list of mysql-user:
/opt/rh/rh-mariadb105/root/bin/mysql --socket=
"/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e 'SELECT user FROM mysql.user'
+-------------+
| User |
+-------------+
| mariadb.sys |
| mysql |
| nextcloud |
| root |
+-------------+
Granted accesses are the following. I just hided the password.
mysql --socket="/var/run/rh-mariadb105-mariadb/nextcloud-mysql.sock" -e "SHOW GRANTS FOR 'nextcloud'@'localhost'"
+------------------------------------------------------------------------------------------------------------------+
| Grants for nextcloud@localhost |
+------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `nextcloud`@`localhost` IDENTIFIED BY PASSWORD '*A****************1' |
| GRANT ALL PRIVILEGES ON `nextcloud`.* TO `nextcloud`@`localhost`