• Resolved frafor

    (@frafor)


    Hi there,

    After the last updates, on a website of mine I’m having a big warning “Shield Security Databases May Need To Be Repaired”.

    If I click to repair the database, tables are actually deleted and recreated, however the message keep appearing.

    I’ve tried to manually delete some table too as mentioned here: https://www.ads-software.com/support/topic/foreign-key-constraint-fails-woocommerce/

    However, I keep getting the message.

    Then I’ve noticed this error in php log, where basically the plugin fails creating the {wp_prefix}_icwp_wpsf_scanitems table for some reason:

    Can't create table '{my_db_name}'.'wp_icwp_wpsf_scanitems' (errno: 150 "Foreign key constraint is incorrectly formed") per la query CREATE TABLE 'wp_icwp_wpsf_scanitems' (
                    id int(11) UNSIGNED NOT NULL AUTO_INCREMENT  COMMENT 'Primary ID', 
    scan_ref int(11) UNSIGNED NOT NULL  COMMENT 'Foreign Key For Primary ID', 
    items text   COMMENT 'Array of scan items', 
    started_at int(15) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Started Scanning Items At', 
    finished_at int(15) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Finished Scanning Items At', 
    PRIMARY KEY  (id), 
    FOREIGN KEY (scan_ref) REFERENCES wp_icwp_wpsf_scans(id) ON DELETE CASCADE ON UPDATE CASCADE
    			) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; fatta da require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, icwp_wpsf_init, require_once('/plugins/wp-simple-firewall/init.php'), ICWP_WPSF_Shield_Security->start, FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller->boot, FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller->loadModules, FernleafSystems\Wordpress\Plugin\Shield\Controller\Checks\PreModulesBootCheck->run, FernleafSystems\Wordpress\Plugin\Shield\Modules\Base\Databases->loadAllDbHandlers, FernleafSystems\Wordpress\Plugin\Shield\Modules\Base\Databases->loadDbH, FernleafSystems\Wordpress\Plugin\Core\Databases\Base\Handler->execute, FernleafSystems\Wordpress\Plugin\Core\Databases\Base\Handler->run, FernleafSystems\Wordpress\Plugin\Core\Databases\Base\Handler->tableInit, FernleafSystems\Wordpress\Plugin\Core\Databases\Common\AlignTableWithSchema->align, FernleafSystems\Wordpress\Services\Core\Db->doSql

    All plugins are up to date

    The plugin was working fine last time I checked (like one week ago)

    • This topic was modified 2 years, 9 months ago by frafor.
    • This topic was modified 2 years, 9 months ago by frafor. Reason: better formatting
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Paul

    (@paultgoodchild)

    Hi,

    Using a tool like phpMyAdmin, or whichever MySQL tool you prefer to use, please delete the following tables in a single delete operation:

    icwp_wpsf_resultitem_meta
    icwp_wpsf_resultitems
    icwp_wpsf_scanitems
    icwp_wpsf_scanresults
    icwp_wpsf_scans

    You may see a few errors in your logs until Shield detects that the tables are all gone and recreates them.

    Thread Starter frafor

    (@frafor)

    Hi, i could only find these 2 tables:

    icwp_wpsf_scans
    icwp_wpsf_scanitems

    Anyway, deleting these two fixed it!

    Plugin Author Paul

    (@paultgoodchild)

    great stuff, glad it sorted!

    Hi,

    I have the same warning and I deleted

    icwp_wpsf_resultitem_meta
    icwp_wpsf_resultitems
    icwp_wpsf_scanitems
    icwp_wpsf_scans

    The icwp_wpsf_scanresults wasn’t there.

    The warning still exist

    I can see that the table icwp_wpsf_scanresults after I click the link to repair, still is not created.

    Plugin Author Paul

    (@paultgoodchild)

    @goustas are you seeing any PHP errors that reoccur? You’ll get a few errors for a half minute immediately after deleting tables, but after that, any new errors?

    Yes,

    I get the below message
    1085338#0: *322847 FastCGI sent in stderr: "PHP message: WordPress database error Tablespace for table 'admin_mvfyg.icwp_wpsf_scanresults' exists. Please DISCARD the tablespace before IMPORT for query CREATE TABLEjKN_icwp_wpsf_scanresults` (
    id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT ‘Primary ID’,
    scan_ref int(11) UNSIGNED NOT NULL COMMENT ‘Foreign Key For Primary ID’,
    resultitem_ref int(11) UNSIGNED NOT NULL COMMENT ‘Foreign Key For Primary ID’,
    created_at int(15) UNSIGNED NOT NULL DEFAULT 0 COMMENT ‘Created’,
    PRIMARY KEY (id),
    FOREIGN KEY (scan_ref) REFERENCES jKN_icwp_wpsf_scans(id) ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY (resultitem_ref) REFERENCES jKN_icwp_wpsf_resultitems(id) ON DELETE CASCADE ON UPDATE CASCADE
    ) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci; made by require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘plugins_loaded’), WP_Hook->do_action, WP_Hook->apply_filters, icwp_wpsf_init, require_once(‘/plugins/…PHP message: WordPress database error Tablespace for table ‘admin_mvfyg.icwp_wpsf_scanresults‘ exists. Please DISCARD the tablespace before IMPORT for query CREATE TABLE jKN_icwp_wpsf_scanresults (
    id int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT ‘Primary ID’,`”

    I had this problem on another website of mine and when I clicked the link to fix it, it was ok. Only at this website do I have this problem. If I uninstalled and reinstall the shield security? Could solve this? Now I cant run malware scans.

    Thanks

    Plugin Author Paul

    (@paultgoodchild)

    That’s a more lower level MySQL error that Shield itself can’t rectify. I would have a chat with your host about the error “Please DISCARD the tablespace before IMPORT…” as there’s something wrong there stopping Shield from creating the new tables

    I managed to fix it.

    I went to /var/lib/mysql/database_name and there was a filename as the table that was causing the above error icwp_wpsf_scanresults.ibd and i renamed it. Then the problem was solved automatically.

    Now is ok.

    Thanks

    Plugin Author Paul

    (@paultgoodchild)

    Ggreat stuff.. glad you got it sorted!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can’t create table `{my_db_name}`.`wp_icwp_wpsf_scanitems` (errno: 150…)’ is closed to new replies.