phpmyadmin sql table PageStatistics deleted

Permalink
Hello,

A colleague somehow deleted the PageStatistics table on our site. So now when I try to get in it says:

mysql error: [1146: Table 'db413797743.PageStatistics' doesn't exist] in EXECUTE("insert into PageStatistics (cID, uID, date) values ('1', 0, NOW())")

There is a backup of this table, but when I try to import this with phpmyadmin it loads up, but then it says:

`pstID` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`cID` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
`date` DATE DEFAULT NULL ,
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
`uID` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY ( `pstID` ) ,
KEY `cID` ( `cID` ) ,
KEY `date` ( `date` ) ,
KEY `uID` ( `uID` )
) ENGINE = MYISAM AUTO_INCREMENT =36813 DEFAULT CHARSET = utf8 AUTO_INCREMENT =36813

MySQL meldet: Dokumentation

#2006 - MySQL server has gone away

so, is there any way to get back into that site or to repair this problem.

thank you very much

ludo

 
Remo replied on at Permalink Best Answer Reply
Remo
run this query and you're good to go:

CREATE TABLE `PageStatistics` (
   `pstID` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
   `cID` INT(10) UNSIGNED NOT NULL DEFAULT '0',
   `date` DATE NULL DEFAULT NULL,
   `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `uID` INT(10) UNSIGNED NOT NULL DEFAULT '0',
   PRIMARY KEY (`pstID`),
   INDEX `cID` (`cID`),
   INDEX `date` (`date`),
   INDEX `uID` (`uID`)
)


The existing records will be gone but they are usually not really useful (which is why we usually disable this statistic)
ludo replied on at Permalink Reply
Dear Remo,

yeah, that was a Bullseye. Thank you so very much.

best

ludo