I have the Linuxserver Nextcloud and MariaDB docker containers and today Nextcloud updated to Nextcloud Hub 10 (31.0.0). I am getting error messages:
Incorrect row format found in your database. ROW_FORMAT=Dynamic offers the best database performances for Nextcloud. Please update row format on the following list:
(followed by a long list of files like oc_activity, oc_accounts_data, oc_activity_mq, oc_addressbookchanges and so on.)
I had the same issue on an older test instance of mine, and I wrote a small bash script that changes the row format for all affected tables. Maybe it is of any help:
Altough the script worked for me, I strongly advise you to back up your database before running it!
#!/bin/bash
# Prompt for database credentials
read -p "Enter Database Name: " DB_NAME
read -p "Enter Username: " DB_USER
read -s -p "Enter Password: " DB_PASS
echo
# Generate ALTER TABLE statements and execute them
mysql -u "$DB_USER" -p"$DB_PASS" -e "
SELECT CONCAT('ALTER TABLE \`', TABLE_NAME, '\` ROW_FORMAT=DYNAMIC;')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = '$DB_NAME'
AND ENGINE = 'InnoDB';
" -B -N | while read -r sql; do
mysql -u "$DB_USER" -p"$DB_PASS" -e "$sql" "$DB_NAME"
done
I copied and pasted all the table names into a text file and manipulated into a list of ALTER commands to make the change. I didn’t think about using a script DOH.
Hello,
Your script changes the ROW_FORMAT of the InnoDB tables to DYNAMIC, but it has a problem: it generates the queries in a first mysql -e and then executes them separately in a loop, which can be problematic if the password is asked for each query. Here is an optimized version that executes everything in one command:
#!/bin/bash
# Prompt for database credentials
read -p "Enter Database Name: " DB_NAME
read -p "Enter Username: " DB_USER
read -s -p "Enter Password: " DB_PASS
echo
# Execute all ALTER TABLE statements in one query
mysql -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -Bse "
SELECT CONCAT('ALTER TABLE \`', TABLE_NAME, '\` ROW_FORMAT=DYNAMIC;')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = '$DB_NAME'
AND ENGINE = 'InnoDB'
" | mysql -u "$DB_USER" -p"$DB_PASS" "$DB_NAME"
This version avoids the loop and executes the queries directly, thus improving efficiency.
what version are you upgrading the nextcloud docker container from? i am still on version 30.0.6 but when i check the database for the row format it already says dynamic.
I also ran into this issue after upgrading. Nextcloud should stop rolling out the update as long as this issue persists. Normal users should not be forced to touch the database. This is kind of annoying.
Great. source .env reads the environment variables from that file, which is the default environment file for Docker. That way you don’t have to type in sensitive data in the command line.
You’re not forced to change them.
But it would be helpful to include instructions in the message or even provide an occ script that updates the database row format.
Yes, you’re absolutely right: a normal user shouldn’t.
But the administrator of a Nextcloud instance should know about the technical basis it runs on and should be able to fix such things. At least after searching and reading some docs.
I have sorted all the errors and discovered it happens to users who were running NC v24 and earlier and have upgraded many times to arrive at the current version. I run nextcloud in a docker container along with mariadb and I (probably foolishly) upgrade automatically with watchtower.