Support » Plugin: WP Statistics » Database Table Missing After Installing Version 8.2

  • Resolved dlsilverman

    (@dlsilverman)


    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/

Viewing 15 replies - 1 through 15 (of 31 total)
  • Plugin Contributor Greg Ross

    (@gregross)

    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;
    dlsilverman

    (@dlsilverman)

    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 !

    dlsilverman

    (@dlsilverman)

    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

    dlsilverman

    (@dlsilverman)

    I am using mySQL Version 5.1.67

    Plugin Contributor Greg Ross

    (@gregross)

    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?

    dlsilverman

    (@dlsilverman)

    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 ?

    dlsilverman

    (@dlsilverman)

    do I need an index on that table?

    pirooz

    (@pirooz)

    I have the same problem.
    I also deleted plugin and reinstall but the problem is remaining.

    pirooz

    (@pirooz)

    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

    (@gregross)

    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)
    		)
    dlsilverman

    (@dlsilverman)

    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

    (@vandman)

    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.

    dlsilverman

    (@dlsilverman)

    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

    dlsilverman

    (@dlsilverman)

    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

    (@majedian21)

    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)
  • The topic ‘Database Table Missing After Installing Version 8.2’ is closed to new replies.