@Gruenbaer opened this Issue on December 22nd 2016

"SQLSTATE[42S02]: Base table or view not found: 1146 Table '[DBNAME].piwik_plugin_setting' doesn't exist"

After automatic upgrade to v3 I receive the above error, I do not know from which version I upgraded.

@tsteur commented on December 22nd 2016 Owner

You may be able to fix this error by executing the following SQL query:

CREATE TABLE piwik_plugin_setting (
                          `plugin_name` VARCHAR(60) NOT NULL,
                          `setting_name` VARCHAR(255) NOT NULL,
                          `setting_value` LONGTEXT NOT NULL,
                          `user_login` VARCHAR(100) NOT NULL DEFAULT '',
                              INDEX(plugin_name, user_login)
                            ) ENGINE=InnoDb DEFAULT CHARSET=utf8

It should have created this table automatically during the update. Was there maybe any error shown?

@frlan commented on January 3rd 2017

I have seen the same error coming from an ancient version 2.8.3 but no previous error

@FlorentCoppint commented on January 17th 2017

Same error upgrading from 2.13.1 to 3.0.1.

@Mark-H commented on February 22nd 2017

Same error here. After running the above SQL query, the error changed to

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database_name.piwik_site_setting' doesn't exist

No errors were shown prior to the database update step. It does seem to mention file issues, but when I tried to resolve those the setup broke, so I'm doing a manual update now.

@claytondaley commented on March 28th 2017 Contributor

+1 upgrading from 2.14.2

Looks like it blew up after 2.15.0-b12 (if that's any help)

@claytondaley commented on March 28th 2017 Contributor

I believe this is simple... the upgrade 2.15.0-b16 rerences $pluginManager:

    public function doUpdate(Updater $updater)
    {
        $this->uninstallPlugin('LeftMenu');
        $this->uninstallPlugin('ZenMode');
    }

    private function uninstallPlugin($plugin)
    {
        $pluginManager = Manager::getInstance();

        if ($pluginManager->isPluginInstalled($plugin)) {
            if ($pluginManager->isPluginActivated($plugin)) {
                $pluginManager->deactivatePlugin($plugin);
            }

            $pluginManager->unloadPlugin($plugin);
            $pluginManager->uninstallPlugin($plugin);
        } else {
            $this->makeSurePluginIsRemovedFromFilesystem($plugin);
        }
    }

When the 3.x codebase attempts to run this command, it tries to use the 3.x table. Obviously, the appropriate tables (let alone entries) don't exist yet.

The "fix" is to upgrade to a late 2.x version before going to 3.x. Even 2.16.3-b2 calls activatePlugin on \Piwik\Plugin\Manager so it may be necessary to go all the way to 2.16.5 before jumping to 3.x.

@mattab commented on June 21st 2017 Owner

When the 3.x codebase attempts to run this command, it tries to use the 3.x table. Obviously, the appropriate tables (let alone entries) don't exist yet.

OK we will need to investigate this and make sure 100% that the upgrade from 2.0 to 3.0 should work.

@claytondaley commented on June 21st 2017 Contributor

Here's what I did:

  • Download and unzip Piwik 2.11.2 into a new subdomain
  • Complete the setup process with a new database
  • Start the upgrade process (I didn't resolve the file integrity issues, but have done so before and it didn't help)

I immediately was prompted with the error:

Critical Error during the update process: 
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'piwik_test.piwik_plugin_setting' doesn't exist
@claytondaley commented on June 21st 2017 Contributor

I also provided a diagnosis and proposed solution in #11552 (now closed)

@mattab commented on June 22nd 2017 Owner

Thank you very much for the steps to reproduce. I can also reproduce it now :+1: we'll investigate in the next few weeks for sure

@pcworld commented on December 9th 2017

I've still had this happen when trying to upgrade from 2.4.0 to 3.2.1 by replacing the files and then accessing the index which triggers the updater.

First I got:
Mysqli prepare error: Table 'database.piwik_plugin_setting' doesn't exist

As suggested I created it manually. Then I got the same error message about piwik_plugin_setting which I then also created manually. It then stopped with
Mysqli prepare error: Unknown column 'plugin_name' in 'where clause'

The workaround from this forum post that worked was to reset the database, then upgrade to 2.17.0 and finally upgrade to 3.2.1.

This Issue was closed on August 3rd 2017
Powered by GitHub Issue Mirror