Support » Plugins and Hacks » WP Statistics » Fix for db error creating Unique index

  • Resolved kitchin

    (@kitchin)


    When upgrading, you may see an error about duplicate entries making MySQL fail and the upgrade fail (may require WP_DEBUG). The error message cites this command:

    ALTER TABLE wp_statistics_visitor ADD UNIQUE KEY date_ip (last_counter,ip)

    The fix is to get into PHPMyAdmin or a similar tool and execute this SQL statement:

    ALTER IGNORE TABLE wp_statistics_visitor ADD UNIQUE KEY date_ip (last_counter,ip)

    Backup your data first of course. This command will delete duplicate rows from the table. My own table went from 930,270 rows to 865,658 rows.

    I’m assuming ‘wp_’ is the prefix in my example. Actually, the plugin could do this fix too, but not using dbDelta.

    The upgrade may also run out of memory and that can cause the table needing REPAIR someone else noticed.

    https://wordpress.org/plugins/wp-statistics/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fix for db error creating Unique index’ is closed to new replies.