4 minutes
Nextcloud DB Error after upgrade
Incorrect definition of table
I’ve got an MariaDB error after upgrading my nextcloud instance. This was the solution.
Updating to nextcloud 24.0.1 got me this error messages from docker-compose logs
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
db_1 | 2022-05-31 14:01:22 6057 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
username@host:~/nextcloud$ docker exec -it nextcloud_db_1 /bin/bash
root@ec2620d59bb5:/# mysql_upgrade --user=root --password=YOUR_ROOT_PASSWORD
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.index_stats OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats 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.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user OK
sys.host_summary OK
sys.host_summary_by_file_io OK
sys.host_summary_by_file_io_type OK
sys.host_summary_by_stages OK
sys.host_summary_by_statement_latency OK
sys.host_summary_by_statement_type OK
sys.innodb_buffer_stats_by_schema OK
sys.innodb_buffer_stats_by_table OK
sys.innodb_lock_waits OK
sys.io_by_thread_by_latency OK
sys.io_global_by_file_by_bytes OK
sys.io_global_by_file_by_latency OK
sys.io_global_by_wait_by_bytes OK
sys.io_global_by_wait_by_latency OK
sys.latest_file_io OK
sys.memory_by_host_by_current_bytes OK
sys.memory_by_thread_by_current_bytes OK
sys.memory_by_user_by_current_bytes OK
sys.memory_global_by_current_bytes OK
sys.memory_global_total OK
sys.metrics OK
sys.processlist OK
sys.ps_check_lost_instrumentation OK
sys.schema_auto_increment_columns OK
sys.schema_index_statistics OK
sys.schema_object_overview OK
sys.schema_redundant_indexes OK
sys.schema_table_lock_waits OK
sys.schema_table_statistics OK
sys.schema_table_statistics_with_buffer OK
sys.schema_tables_with_full_table_scans OK
sys.schema_unused_indexes OK
sys.session OK
sys.session_ssl_status OK
sys.statement_analysis OK
sys.statements_with_errors_or_warnings OK
sys.statements_with_full_table_scans OK
sys.statements_with_runtimes_in_95th_percentile OK
sys.statements_with_sorting OK
sys.statements_with_temp_tables OK
sys.user_summary OK
sys.user_summary_by_file_io OK
sys.user_summary_by_file_io_type OK
sys.user_summary_by_stages OK
sys.user_summary_by_statement_latency OK
sys.user_summary_by_statement_type OK
sys.version OK
sys.wait_classes_global_by_avg_latency OK
sys.wait_classes_global_by_latency OK
sys.waits_by_host_by_latency OK
sys.waits_by_user_by_latency OK
sys.waits_global_by_latency OK
sys.x$host_summary OK
sys.x$host_summary_by_file_io OK
sys.x$host_summary_by_file_io_type OK
sys.x$host_summary_by_stages OK
sys.x$host_summary_by_statement_latency OK
sys.x$host_summary_by_statement_type OK
sys.x$innodb_buffer_stats_by_schema OK
sys.x$innodb_buffer_stats_by_table OK
sys.x$innodb_lock_waits OK
sys.x$io_by_thread_by_latency OK
sys.x$io_global_by_file_by_bytes OK
sys.x$io_global_by_file_by_latency OK
sys.x$io_global_by_wait_by_bytes OK
sys.x$io_global_by_wait_by_latency OK
sys.x$latest_file_io OK
sys.x$memory_by_host_by_current_bytes OK
sys.x$memory_by_thread_by_current_bytes OK
sys.x$memory_by_user_by_current_bytes OK
sys.x$memory_global_by_current_bytes OK
sys.x$memory_global_total OK
sys.x$processlist OK
sys.x$ps_digest_95th_percentile_by_avg_us OK
sys.x$ps_digest_avg_latency_distribution OK
sys.x$ps_schema_table_statistics_io OK
sys.x$schema_flattened_keys OK
sys.x$schema_index_statistics OK
sys.x$schema_table_lock_waits OK
sys.x$schema_table_statistics OK
sys.x$schema_table_statistics_with_buffer OK
sys.x$schema_tables_with_full_table_scans OK
sys.x$session OK
sys.x$statement_analysis OK
sys.x$statements_with_errors_or_warnings OK
sys.x$statements_with_full_table_scans OK
sys.x$statements_with_runtimes_in_95th_percentile OK
sys.x$statements_with_sorting OK
sys.x$statements_with_temp_tables OK
sys.x$user_summary OK
sys.x$user_summary_by_file_io OK
sys.x$user_summary_by_file_io_type OK
sys.x$user_summary_by_stages OK
sys.x$user_summary_by_statement_latency OK
sys.x$user_summary_by_statement_type OK
sys.x$wait_classes_global_by_avg_latency OK
sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
nextcloud
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_bookmarks OK
nextcloud.oc_bookmarks_folders OK
nextcloud.oc_bookmarks_folders_public OK
nextcloud.oc_bookmarks_root_folders OK
nextcloud.oc_bookmarks_shared_folders OK
nextcloud.oc_bookmarks_shared_to_shares OK
nextcloud.oc_bookmarks_shares OK
nextcloud.oc_bookmarks_tags OK
nextcloud.oc_bookmarks_tree 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_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_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_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
performance_schema
sys
sys.sys_config OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
root@ec2620d59bb5:/#
Now it shoudl run again.