Question

I connect with user "root" onto my database "test" which I host locally for development. Among others I have the table "ratingcomment". For some reason when I click on the table "ratingcomment" phpMyAdmin shows me the following error:

Fehler

    SQL-Befehl: 

    INSERT INTO  `phpmyadmin`.`pma_history` (

    `username` ,
     `db` ,
     `table` ,
     `timevalue` ,
     `sqlquery`
    )
    VALUES (
    'root',  'test',  'ratingcomment', NOW( ) ,  'SELECT * FROM `ratingcomment`'
    )
    MySQL meldet: 

    #1062 - Duplicate entry '838' for key 'PRIMARY'

I used google to finde out the following

"This indicates that you have a UNIQUE or PRIMARY index on a table, and there is a duplicate value someone on one of the values in one of these indexes."

But I still dont quite understand the error! I use a primary Key, which auto-increments for all of my tables, so there actually shouldnt be a problem with the table. I had another table named "rating" which had a column "comment". Can it be, that this causes problems?

Was it helpful?

Solution

Quick fix:

REPAIR TABLE `phpmyadmin`.`pma_history`

If that fails, I'd just truncate/empty the table.

TRUNCATE TABLE `phpmyadmin`.`pma_history`

Although phpmyadmin has it's place in my toolbox, I personally don't use it's internal db.

ADDENDUM

MyISAM tables can easily become corrupted. A couple causes that usually hit me: if the MySQL is not shutdown properly, or if the table has a FULLTEXT index and the stopword file on disk had changed.

Simply stated, the REPAIR just checkes the data file for errors (and depending on your options, makes it usable again) and rewrites the index file. Fair warning: with MyISAM, repairing a table can often toast all your data in that table to make it usable. See doc for more details.

A google search pertaining to this pma table being corrupted lead me to this.

OTHER TIPS

This appears to be an internal error. You've issued this query:

SELECT * FROM `ratingcomment`

phpMyAdmin tries to write such action in its internal event log and it fails. If you Google for pma_history you'll find several references to such table being corrupted.

My advice is that you find another SQL client (such as HeidiSQL) and try to repair the phpMyAdmin database.

I know this is kinda late but I had the same problem and wanted to share what I did.

In PhpMyAdmin, I went to the table's Operation tab, and just incremented the AUTO_INCREMENT value under Table options and inserted a dummy record.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top