Title: Database error
Last modified: August 30, 2016

---

# Database error

 *  Resolved [mediakreativ](https://wordpress.org/support/users/mediakreativ/)
 * (@mediakreativ)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/)
 * Hi there,
 * I recognized the following error in the logs:
 * Table ‘xyz.wp_slim_events’ doesn’t exist for query #015#012#011#011#011$
 * Any idea what can be the problem?
 * [https://wordpress.org/plugins/wp-slimstat/](https://wordpress.org/plugins/wp-slimstat/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/#post-6201346)
 * The upgrade from version 3.9 to version 4.0 introduces a new table, which for
   some reason was not created when you updated the plugin.
 * You can try to create it in phpMyAdmin by using the SQL code in here:
 * [https://plugins.trac.wordpress.org/browser/wp-slimstat/trunk/admin/wp-slimstat-admin.php#L261](https://plugins.trac.wordpress.org/browser/wp-slimstat/trunk/admin/wp-slimstat-admin.php#L261)
 *  [Mr-Manor](https://wordpress.org/support/users/mr-manor/)
 * (@mr-manor)
 * [10 years ago](https://wordpress.org/support/topic/database-error-182/#post-6201604)
 * If have seen (and ignored for quite a while) this on 3 different multisite installations,
   one not even maintain be me. I do think that some circumstances/installations
   may lead to this error.
 * I have tried to create one missing table like this:
 * > CREATE TABLE IF NOT EXISTS `sc_629_slim_events` (
   >  `event_id` int(10) NOT NULL
   > AUTO_INCREMENT, `type` tinyint(3) unsigned DEFAULT ‘0’, `event_description`
   > varchar(64) DEFAULT NULL, `notes` varchar(256) DEFAULT NULL, `position` varchar(
   > 32) DEFAULT NULL, `id` int(10) unsigned NOT NULL DEFAULT ‘0’, `dt` int(10) 
   > unsigned DEFAULT ‘0’, PRIMARY KEY (`event_id`), KEY `idx_sc_629_slim_events`(`
   > dt`), KEY `fk_sc_629_id` (`id`), CONSTRAINT `fk_sc_629_id` FOREIGN KEY (`id`)
   > REFERENCES `sc_629_slim_stats` (`id`) ON DELETE CASCADE ON UPDATE CASCADE )
   > ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;n
 * But mysql responds with:
 * > 160519 13:30:55 Error in foreign key constraint creation for table `fak-sites`.`
   > sc_629_slim_events`.
   >  A foreign key constraint of name `fak-sites`.`fk_sc_629_id`
   > already exists.
 * Please advise how to proceed.
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/#post-6201605)
 * Hi,
 * for some reason you have a foreign key with that name already. Probably a leftover
   of a previous database upgrade?
 * You can change the CONSTRAINT to read:
 * CONSTRAINT fk_sc_629_slimstats_id FOREIGN KEY (id) REFERENCES
 * and leave the rest unchanged. Let me know if that works.
 * Best,
    Jason
 *  [Mr-Manor](https://wordpress.org/support/users/mr-manor/)
 * (@mr-manor)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/#post-6201606)
 * Yes, by changing the symbol I can execute the create statement. It also seem 
   to cure the problem as I can now visit (and leave by link to external resource)
   the blog in question without error messages. I am a bit puzzled though as no 
   data is entered in the mentioned table.
 * I must admit though that I have not much idea on what am I actually doing. Mysql
   constraints is above my current sql knowledge level.
 * Should I make a similar CREATE statement for all active subsites on our system?
 * Regards
    Klaus
 *  Plugin Contributor [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * (@coolmann)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/#post-6201607)
 * > I am a bit puzzled though as no data is entered in the mentioned table.
 * Slimstat uses this table to store information about events (click coordinates,
   custom client-side events, etc). If you don’t have any of those on your site,
   the table will stay empty.
 * > Should I make a similar CREATE statement for all active subsites on our system?
 * Each blog in your MU network will need one, yes. Make sure to reference the right
   tables, though.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Database error’ is closed to new replies.

 * ![](https://ps.w.org/wp-slimstat/assets/icon.svg?rev=2832242)
 * [SlimStat Analytics](https://wordpress.org/plugins/wp-slimstat/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-slimstat/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-slimstat/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-slimstat/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-slimstat/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-slimstat/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Jason Crouse](https://wordpress.org/support/users/coolmann/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/database-error-182/#post-6201607)
 * Status: resolved