Title: Database Table Missing After Installing Version 8.2
Last modified: August 22, 2016

---

# Database Table Missing After Installing Version 8.2

 *  Resolved [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/)
 * After updating to version 8.2 I am now receiving this message several times a
   minute:
    WordPress database error Table ‘wp_statistics_historical’ doesn’t exist
   for query SELECT value FROM wp_statistics_historical WHERE type=’visitors’ made
   by wp_dashboard, do_meta_boxes, call_user_func, wp_statistics_dashboard_widget,
   wp_statistics_visitor, WP_Statistics->Get_Historical_Data
 * [https://wordpress.org/plugins/wp-statistics/](https://wordpress.org/plugins/wp-statistics/)

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/2/?output_format=md)

 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464736)
 * Can you access phpMyAdmin and verify the table exits (or doesn’t as the case 
   may be)?
 * If it doesn’t exist then it wasn’t created for some reason during the upgrade.
   You can try rerunning the upgrade manually by going to Statistics->Optimization-
   >Database and clicking “Install now!”.
 * If the table is still not created, you can use phpMyAdmin to create it with the
   following SQL:
 *     ```
       CREATE TABLE IF NOT EXISTS wp_statistics_historical (
         key bigint(20) NOT NULL,
         type varchar(25) NOT NULL,
         id bigint(20) NOT NULL,
         uri varchar(255) NOT NULL,
         value bigint(20) NOT NULL
       ) AUTO_INCREMENT=48 DEFAULT CHARSET=utf8;
       ```
   
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464745)
 * I checked with phpMyAdmin and the table does NOT exist. I think I will simply
   use the SQL to create it. Thanks for the advice !
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464746)
 * I couldnt run that SQL – received the following error:
 * #1064 – You have an error in your SQL syntax; check the manual that corresponds
   to your MySQL server version for the right syntax to use near ‘bigint(20) NOT
   NULL, type varchar(25) NOT NULL, id bigint(20) NOT NULL, ur’ at line 2
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464748)
 * I am using mySQL Version 5.1.67
 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464754)
 * Well that would explain why the upgrade code didn’t create the table for you 
   🙂
 * Can you try and create the table using the phpMyAdmin interface instead of the
   direct SQL and see what happens?
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464759)
 * I created it through the phpMyAdmin User Interface but I couldnt figure out how
   to do the AUTOINCREMENT=48 or DEFAULT CHARSET … but the table is created now …
   is the autoincrement important ?
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464763)
 * do I need an index on that table?
 *  [pirooz](https://wordpress.org/support/users/pirooz/)
 * (@pirooz)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464784)
 * I have the same problem.
    I also deleted plugin and reinstall but the problem
   is remaining.
 *  [pirooz](https://wordpress.org/support/users/pirooz/)
 * (@pirooz)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464786)
 * I used phpmyadmin and faced to this error:
 * #1064 – You have an error in your SQL syntax; check the manual that corresponds
   to your MySQL server version for the right syntax to use near ‘bigint(20) NOT
   NULL,
    type varchar(25) NOT NULL, id bigint(20) NOT NULL, ‘ at line 2
 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464867)
 * Try the following SQL:
 *     ```
       CREATE TABLE wp_statistics_historical (
       			key bigint(20) NOT NULL,
       			type varchar(25) NOT NULL,
       			id bigint(20) NOT NULL,
       			uri varchar(255) NOT NULL,
       			value bigint(20) NOT NULL,
       			PRIMARY KEY  (ID),
       			KEY type (type),
       			UNIQUE KEY id (id),
       			UNIQUE KEY uri (uri)
       		)
       ```
   
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464878)
 * Greg,
 * For some reason my mySQL rejects that CREATE TABLE as well. I would guess it 
   has to do with the version of mySQL that I am running. If I have time I’ll try
   narrowing down the problem, but I am thinking it may have to do with the “NOT
   NULL” syntax.
 * I’ve created the table manually with the keys you suggested and everything seems
   to be working fine. Thanks for your attention to this !
 * David
 *  [vandman](https://wordpress.org/support/users/vandman/)
 * (@vandman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464890)
 * I think the error comes from the fact they create a row using a keyword
    key 
   bigint(20) NOT NULL, Key means something special for mysql, KEY is normally a
   synonym for INDEX. So it is not something that can be used as a row. I think 
   the table needs to be corrected.
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464895)
 * I think you’re right Vandman – the keyword “key” probably cant be used as a column
   name in that syntax. When I created the table manually using the graphical user
   interface in mySQL it didn’t object to using “key” as a column name, but when
   it is done in the “CREATE TABLE” command it is confusing the mySQL engine. That
   would be my guess.
 * David
 *  Thread Starter [dlsilverman](https://wordpress.org/support/users/dlsilverman/)
 * (@dlsilverman)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464896)
 * When I used the option in phpMyAdmin to dump the table structure, it created 
   an SQL statement with all of the column names enclosed in back quotes. This will
   solve the problem.
 *  [majedian21](https://wordpress.org/support/users/majedian21/)
 * (@majedian21)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/#post-5464901)
 * I had the same issue and putting backticks around the column names “key” and “
   type” appears to have allowed me to create the table and my errors stopped.

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/2/?output_format=md)

The topic ‘Database Table Missing After Installing Version 8.2’ is closed to new
replies.

 * ![](https://ps.w.org/wp-statistics/assets/icon.svg?rev=3081064)
 * [WP Statistics – Simple, privacy-friendly Google Analytics alternative](https://wordpress.org/plugins/wp-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-statistics/reviews/)

## Tags

 * [Database Error](https://wordpress.org/support/topic-tag/database-error/)
 * [table missing](https://wordpress.org/support/topic-tag/table-missing/)

 * 31 replies
 * 9 participants
 * Last reply from: [y060121](https://wordpress.org/support/users/y060121/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/database-table-missing-after-installing-version-82/page/3/#post-5465093)
 * Status: resolved