Support

Home Forums Event Espresso Premium Promotion module can't create a table

Promotion module can't create a table

Posted: August 22, 2018 at 4:18 am

Viewing 20 reply threads


Andrew Appleton

August 22, 2018 at 4:18 am

I have recently updated all the EE4 plugins and when I activate the Promotion plugin it gives the following error:

Can’t create table ‘XXXXX.XXX.wp_esp_promotion_object’ (errno: -1) I have removed the database name and replaced with XXX.

Followed by:
CREATE TABLE wp_esp_promotion_object ( POB_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, PRO_ID INT UNSIGNED NOT NULL, OBJ_ID INT UNSIGNED NOT NULL, POB_type VARCHAR(45) NULL, POB_used INT NULL, PRIMARY KEY (POB_ID), KEY OBJ_ID (OBJ_ID), KEY PRO_ID (PRO_ID) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci

This is the info Health Check gives on my site:

WordPress Version 4.9.8
Plugin Versions
Your site has 2 plugins waiting to be updated.
Your site has 3 inactive plugins, it is recommended to remove any unused plugins to enhance your site security.
Theme Versions
Your site has 3 themes waiting to be updated.
Your site has 4 inactive themes, other than twentyseventeen, the default WordPress theme, and Divi, your active theme. It is recommended to remove any unused themes to enhance your sites security.
Your site does not have a default theme, default themes are used by WordPress automatically if anything is wrong with your normal theme.
PHP Version 5.6.37 – For best performance we recommend using PHP 7.2 or higher.
Database Server version 5.5.60-cll
– For performance and security reasons, we strongly recommend running MySQL version 5.6 or higher.
JSON Extension Your PHP install supports JSON.
MySQL utf8mb4 support Your MySQL version supports utf8mb4
Communication with WordPress.org WordPress.org is reachable from your server.
HTTPS status You are not using HTTPS to access this website.
Secure communication Your WordPress install can communicate securely with other services.
Scheduled events No scheduled events have been missed.
Background updates
A plugin has prevented updates by disabling wp_version_check().
No version control systems were detected.
Your installation of WordPress doesn’t require FTP credentials to perform updates.
All of your WordPress files are writable.
Loopback request The loopback request to your site failed, this may prevent WP_Cron from working, along with theme and plugin editors.
Error encountered: (0) cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

Event Espresso is Version 4.9.67.p

Any help would be appreciated.


Josh

  • Support Staff

August 22, 2018 at 6:44 am

Hi,

Two things:

1) The mysql user that is configured to access the database for your website needs to have the privilege of creating tables in order for the promotions plugin to be set up and function.

2) The Health Check plugin recommends updating the database server to a newer version.

You can contact your web host and inquire about both items.


Andrew Appleton

August 22, 2018 at 6:52 am

Hi Josh, thanks as always for the quick response. I will check permissions and see about upgrading My SQL.


Andrew Appleton

August 22, 2018 at 7:38 am

Permissions for the user are all boxes ticked. I have upgraded to MySQL 5.6. When I activate the Promotion plugin I get the same message but suffixed with : wp_esp_promotion_object`’ exists. Please DISCARD the tablespace before IMPORT


Josh

  • Support Staff

August 22, 2018 at 7:59 am

According to
https://stackoverflow.com/questions/15694168/error-tablespace-for-table-xxx-exists-please-discard-the-tablespace-before-imp
there is a file like wp_esp_promotion_object.idb that should be moved to somewhere else to be safe, then the db server should be restarted.

It’s advised to do a database backup first and check with the server admin and ask them to check for a locked table and clear that first.


Andrew Appleton

August 22, 2018 at 8:01 am

Thanks, will take a look at that.


Andrew Appleton

August 22, 2018 at 8:15 am

I can’t find any file called wp_esp_promotion_object.idb. Have restarted the db server and still the same. I am not sure if this helps you but under the database error is this:

Stack Trace:#0 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/helpers/EEH_Activation.helper.php(671): EventEspresso\core\services\database\TableManager->createTable(‘esp_promotion_o…’, ‘POB_ID INT UNSI…’, ‘InnoDB ‘) #1 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php(647): EEH_Activation::create_table(‘esp_promotion_o…’, ‘POB_ID INT UNSI…’, ‘ENGINE=InnoDB ‘, false) #2 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php(553): EE_Data_Migration_Script_Base->_create_table_and_catch_errors(‘esp_promotion_o…’, ‘POB_ID INT UNSI…’, ‘ENGINE=InnoDB ‘, false) #3 /home/training/public_html/wp-content/plugins/eea-promotions/core/data_migration_scripts/EE_DMS_Promotions_1_0_0.dms.php(78): EE_Data_Migration_Script_Base->_table_should_exist_previously(‘esp_promotion_o…’, ‘POB_ID INT UNSI…’, ‘ENGINE=InnoDB ‘) #4 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/EE_Addon.core.php(428): EE_DMS_Promotions_1_0_0->schema_changes_before_migration() #5 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/EE_Addon.core.php(381): EE_Addon->initialize_db() #6 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/EE_System.core.php(590): EE_Addon->initialize_db_if_no_migrations_required() #7 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2527): EE_System->initialize_addons() #8 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2457): EEM_Base->_verify_addons_db(‘get_results’, Array) #9 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2468): EEM_Base->_process_wpdb_query(‘get_results’, Array) #10 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(2395): EEM_Base->_process_wpdb_query(‘get_results’, Array) #11 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(1080): EEM_Base->_do_wpdb_query(‘get_results’, Array) #12 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/db_models/EEM_Base.model.php(954): EEM_Base->_get_all_wpdb_results(Array, ‘ARRAY_A’, NULL) #13 /home/training/public_html/wp-content/plugins/eea-promotions/admin/promotions/Promotions_Admin_List_Table.class.php(278): EEM_Base->get_all(Array) #14 /home/training/public_html/wp-content/plugins/eea-promotions/admin/promotions/Promotions_Admin_List_Table.class.php(26): Promotions_Admin_List_Table->_get_promotions(10) #15 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_List_Table.core.php(212): Promotions_Admin_List_Table->_setup_data() #16 [internal function]: EE_Admin_List_Table->__construct(Object(Promotions_Admin_Page)) #17 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/EE_Registry.core.php(1262): ReflectionClass->newInstanceArgs(Array) #18 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/EE_Registry.core.php(773): EE_Registry->_create_object(‘Promotions_Admi…’, Array, ”, false) #19 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/services/loaders/CoreLoader.php(117): EE_Registry->create(‘Promotions_Admi…’, Array, true, false, false, false) #20 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/services/loaders/CachingLoader.php(147): EventEspresso\core\services\loaders\CoreLoader->load(‘Promotions_Admi…’, Array, true) #21 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/services/loaders/Loader.php(82): EventEspresso\core\services\loaders\CachingLoader->load(‘Promotions_Admi…’, Array, true) #22 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/services/loaders/Loader.php(105): EventEspresso\core\services\loaders\Loader->load(‘Promotions_Admi…’, Array) #23 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(2145): EventEspresso\core\services\loaders\Loader->getShared(‘Promotions_Admi…’, Array) #24 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(2096): EE_Admin_Page->_set_list_table_object() #25 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(676): EE_Admin_Page->_set_list_table() #26 /home/training/public_html/wp-content/plugins/event-espresso-core-reg/core/admin/EE_Admin_Page.core.php(639): EE_Admin_Page->_load_page_dependencies() #27 [internal function]: EE_Admin_Page->load_page_dependencies(”) #28 /home/training/public_html/wp-includes/class-wp-hook.php(286): call_user_func_array(Array, Array) #29 /home/training/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(”, Array) #30 /home/training/public_html/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #31 /home/training/public_html/wp-admin/admin.php(214): do_action(‘load-event-espr…’) #32 {main}


Josh

  • Support Staff

August 22, 2018 at 9:21 am

What do you get if you run SELECT * FROM information_schema.INNODB_SYS_TABLESPACES?


Andrew Appleton

August 22, 2018 at 9:46 am

I have located the two ibd files that contain promotion but they have no associated frm files. They are wp_esp_promotion_object.ibd and wp_esp_promotion.ibd. I renamed them, restarted the db server and then re activated the plugin and it says: wp_esp_promotion_object`’ already exists

Just run your query and it gives a syntax error.

By the way I have now upgraded to MySQL 5.7 as I was getting reporting that some of the other plugins were not compatible with 5.6. I double checked on your forums first that EE was OK with 5.7.

Also tried disabling all other plugins except EE and that didn’t work.

It looks like the promotion plugin is trying to create the .frm files but can’t.


Josh

  • Support Staff

August 22, 2018 at 9:56 am

The promotions plugin doesn’t directly create the form files, that happens at a lower level.

Do you have backups of the two promotions tables that can be restored to?


Andrew Appleton

August 22, 2018 at 9:59 am

Just run your query again, my mistake I had a typo! It now returns
#1227 – Access denied; you need (at least one of) the PROCESS privilege(s) for this operation

I do have backups but it will be of the MySQL 5.5.


Josh

  • Support Staff

August 22, 2018 at 10:17 am

Ideally you could import the backups onto another server and try them out there before importing onto the live server.


Andrew Appleton

August 22, 2018 at 10:23 am

I will give it a go. This could be a late night!


Andrew Appleton

August 22, 2018 at 11:20 am

This is where I am up to:

Restored the backup to a temporary database.
Made sure wp_esp_promotion.ibd and wp_esp_promotion_object.ibd were deleted

Copied wp_esp_promotion.ibd to the working database and got an error that the table already exists even though it is not visible in the list of tables.


Josh

  • Support Staff

August 22, 2018 at 11:30 am

I don’t think you’d actually copy .ibd files. Instead you’ll use a tool like phpmyadmin to import the table.


Andrew Appleton

August 22, 2018 at 11:32 am

That’s what I did. Deleted the files in terminal in WHM first then used phpmyadmin to create a temporary database, imported the backup and then copied one of the promotion tables across to the working database. It gave an error that the table already exists.


Josh

  • Support Staff

August 22, 2018 at 12:17 pm

The working database would already have that table though, right?


Andrew Appleton

August 22, 2018 at 12:20 pm

The working database did not show the two promotion tables in PHPMyadmin until I copied the relevant .frm files from the backup. Now I can see the tables and data in the working database in PHPMyadmin but when I run the promotion plugin I get a permissions error. I need to change the owner and permissions of the files I copied from the backup.

I am on that now and fingers crossed it will work.


Andrew Appleton

August 22, 2018 at 12:39 pm

That didn’t work. I changed the ownership and the group of wp_esp_promotion.frm
wp_esp_promotion_object.frm
Then ran the plugin again, it gave an error wp_esp_promotion_object‘ exists. The database then dissapeared from PHPMyadmin and the two .frm files have been deleted.


Josh

  • Support Staff

August 22, 2018 at 1:11 pm

You should probably stick with the solutions outlined here:

https://stackoverflow.com/questions/15694168/error-tablespace-for-table-xxx-exists-please-discard-the-tablespace-before-imp


Andrew Appleton

August 23, 2018 at 1:16 am

I worked my way through that post and after a lot of trial and error I now have it working. I created a new database, restored data from 3 days ago, deleted the original database and redirected WP to the new one. I had to manually add the existing promo codes but there were only a few that were still active of the 115 on the old system.

Checking historical bookings the original discount codes still show on the bookings even though they are not in the Promotions plugin.

Thanks for your help.

Viewing 20 reply threads

The support post ‘Promotion module can't create a table’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso