It may happen in rare cases that Matomo (Piwik) believes it has upgraded to a newer version, but that the database itself was not actually upgraded. This FAQ explains how to re-run the database upgrade from a particular version.

For example, this could happen if the database crashed or overloaded during the DB upgrade (we recommend to enable maintenance and run the ugprade in the command line). It could also happen if the new Matomo files in core/Updates/ haven’t yet been uploaded to the latest files, but a Matomo user visits the Matomo UI and issues the partial upgrade leading to the errors.

As a result SQL error messages are often printed in some – or all – the reports. Errors messages such as

Error trying to execute the query 'CREATE TABLE [...]  Base table or view already exists: 1050 Table exists

or

SQLSTATE[42S22]: Column not found: 1054 Unknown column on clause

or

SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP X check that column/key exist

or

Error trying to execute the query 'ALTER TABLE' SQLSTATE[42S22]: Column not found: 1054 Unknown column

or

Error in Matomo (tracker): Error query: fetch() failed: Unknown column '...' in 'field list'

The good news is that it possible in all cases to resolve the issue and not experience any data loss or other problem!

You can manually tell Matomo to run the upgrade again by executing the following SQL query (eg. using a tool such as phpMyAdmin):

UPDATE `matomo_option` SET option_value = "1.X" WHERE option_name = "version_core";

Replace 1.X with the version you were using prior to upgrading, for example « 1.10 ». After running this query, visit Matomo: you should see the upgrade screen again. You can run the upgrade in the command line if your Matomo is large, or simply click the button and wait until completion.

If you still have problems, you can get help in the forums or contact Support team.

Previous FAQ: After I updated Matomo, it stopped working (blank page, widgets not loading, error message, etc.). How can I fix this?