Support » Plugin: WordPress Popular Posts » Database tables are not installed

  • Resolved umchal

    (@umchal)


    Hi there,

    I just installed the plugin on my local test site and it does not count or show any visits. I wondered why and checked the database. I don’t find neither wp_popularpostsdata nor wp_popularpostssummary tables. I find them on other sites. And the plugin works fine on other sites but not on local.

    Deactivated all the other plugins and reinstalled this plugin and it did not help. Using the default theme Twenty Seventeen.

    Any ideas?

    WordPress Popular Posts 5.0.1
    WordPress 5.3
    PHP 7.3

    MySQL
    Extension mysqli
    Server version 10.1.9-MariaDB
    Client version mysqlnd 5.0.12-dev
    Database user root
    Database host localhost
    Database name wp53
    Database prefix wp_
    Database charset utf8mb4
    Database collation utf8mb4_unicode_ci

    When reinstalled the plugin I get the following message.

    
    The plugin generated 1144 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
    

    If I reactivate the plugin, the message does not appear.

    • This topic was modified 1 month, 2 weeks ago by umchal. Reason: added the MySQL info
    • This topic was modified 1 month, 2 weeks ago by umchal. Reason: added additional info
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @umchal,

    Try checking MySQL’s error log to see if something happened when WPP attempted to create its database tables. You may also want to have a look at WordPress’ Debug Log, although in my experience it rarely shows any info on table creation/modification errors.

    Alternatively:

    • Make sure your database user has enough permissions to create and alter tables (although if you were able to install -not import an existing database- WordPress locally I guess it does have said permissions but it won’t hurt to check), or
    • Try running the queries manually (adjust where needed, read the code in detail), or
    • Export both the _popularpostsdata and the _popularpostssummary tables from one of your sites, import them into your local database, and truncate them so they’re clean for your local site.

    After enabling the debug mode, I get the following in the debug.log.

    
    [04-Dec-2019 17:13:37 UTC] WordPress database error Unknown storage engine 'InnoDB' for query 
            CREATE TABLE wp_popularpostsdata (
                postid bigint(20) NOT NULL,
                day datetime NOT NULL,
                last_viewed datetime NOT NULL,
                pageviews bigint(20) DEFAULT 1,
                PRIMARY KEY  (postid)
            ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB made by activate_plugin, do_action('activate_wordpress-popular-posts/wordpress-popular-posts.php'), WP_Hook->do_action, WP_Hook->apply_filters, WordPressPopularPosts\Activation\Activator::activate, WordPressPopularPosts\Activation\Activator::plugin_activate, WordPressPopularPosts\Activation\Activator::do_db_tables, dbDelta
    [04-Dec-2019 17:13:37 UTC] WordPress database error Unknown storage engine 'InnoDB' for query 
            CREATE TABLE wp_popularpostssummary (
                ID bigint(20) NOT NULL AUTO_INCREMENT,
                postid bigint(20) NOT NULL,
                pageviews bigint(20) NOT NULL DEFAULT 1,
                view_date date NOT NULL,
                view_datetime datetime NOT NULL,
                PRIMARY KEY  (ID),
                KEY postid (postid),
                KEY view_date (view_date),
                KEY view_datetime (view_datetime)
            ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB made by activate_plugin, do_action('activate_wordpress-popular-posts/wordpress-popular-posts.php'), WP_Hook->do_action, WP_Hook->apply_filters, WordPressPopularPosts\Activation\Activator::activate, WordPressPopularPosts\Activation\Activator::plugin_activate, WordPressPopularPosts\Activation\Activator::do_db_tables, dbDelta
    

    mysql_error.log does not show any log related to it.

    OK, solved.

    There was a line in the MySQL configuration file.

    
    skip-innodb
    

    Changed it to

    
    #skip-innodb
    

    And restarted the MySQL service. Then reinstalled the plugin. Now I see the two tables created.

    Thank you.

    Plugin Author Héctor Cabrera

    (@hcabrera)

    This is the problem:

    Unknown storage engine ‘InnoDB’

    Your local database server may not be properly configured as the InnoDB engine is not available or it has been disabled. How to fix that is a bit out of my area of expertise but I’d start by checking MariaDB’s config files and debug from there.

    Edit: ah, I see you were able to figure it out while I was typing this comment haha. Good work!

    Suggestions: maybe, in a future version, 1. add a check if the server supports InnoDB upon installation. 2. in the stats page, show a notification to tell the user that the necessary tables are do not exist for such cases.

    I suggest these because this way, it prevents those who failed to installed the plugin properly like I did from spending too much time figuring out what’s going on. Currently, the user has too little clues.

    I hope you consider it. Thank you.

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Sure thing, thanks for the suggestions!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.