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.
Thread Starter
umchal
(@umchal)
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.
Thread Starter
umchal
(@umchal)
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.
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!
Thread Starter
umchal
(@umchal)
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.
Sure thing, thanks for the suggestions!