mysql 1062 error - is this concrete 5 or bluehost?

Permalink 3 users found helpful
Hi,

This morning I went to log in to one of my concrete 5 sites and saw the following error message:

An unexpected error occured

mysql error: [1062: Duplicate entry '2067' for key 'PRIMARY'] in EXECUTE("insert into PageStatistics (cID, uID, date) values ('1', 0, NOW())")

Anyone able to shed some light??

Many thanks

Alex

1 Attachment

agile
View Replies:
mesuva replied on at Permalink Reply
mesuva
It's a pretty harmless error (but I don't know what causes it).

I suggest to turn off site statistics in the dashboard. I normally turn it off anyway as it's not generally useful, especially if you use something else like Google Analytics.

I appreciate the option being there, but I'd prefer it to be off by default.

With statistics turned off, I doubt you'll see that error again.
agile replied on at Permalink Reply
agile
Great, thanks, but as the webpage doesn't load, I can't log in to the site to access the dashboard.

Any suggestions?

Thanks
mesuva replied on at Permalink Reply
mesuva
Can you manually visit
/index.php/login
and log in there?
agile replied on at Permalink Reply
agile
I've tried manually loading as you suggested but I still can't get beyond the error page.

Any other ideas?

Thanks
mesuva replied on at Permalink Reply
mesuva
Perhaps have a look at the PageStatistics table in your database (using something like phpMyAdmin) and see if you can either empty that table (if you don't care about the data), or delete the record it is complaining about.
agile replied on at Permalink Reply
agile
As you've probably guessed, I'm a bit of an amateur and that's a bit beyond me.

I appreciate you taking time to help.

Any other ideas?

Thanks
mkly replied on at Permalink Reply
mkly
This won't solve anything it there is a larger problem going on, but if you have ftp access upload a file to the /tools directory called like fixdb.php with this code
<?php
$db = Loader::db();
$db->Excecute('DELETE FROM PageStatistics WHERE pstID = 2067');
echo 'Deleted record, now delete this file';
?>

Then browse to
http://www.example.com/index.php/tools/required/fixdb

replace example.com with your domain
Then delete that file.

Edit. Forgot php tag
agile replied on at Permalink Reply
agile
Hi mkly,

Thanks for this, I'll give it a try, but can you just confirm a little here for me, sorry, am a novice.

If I go to the /tools folder, it's currently empty. I've edited code in existing files without a problem, but haven't formed a new file...

what do I call the file I create?

Also, what did you mean by Forgot php tag?

Thank you for this and sorry again for being such an amateur!

Alex
adajad replied on at Permalink Reply
adajad
What mkly is saying you should create a file locally with the code he provided above. You can call that file fixdb.php when you save it.

Then upload that file to your host and put it in your root/tools folder.

After that you browse to 'www.yourdomain.com/index.php/tools/required/fixdb.php'

You will now only see a text in your browser telling you 'Deleted record, now delete this file'

Once that is done, you should delete the file 'fixdb.php' you uploaded before.

His 'Forgot php tag' was just him telling you he forgot a tag when he first posted his code, but it is now edited and fixed.
agile replied on at Permalink Reply
agile
Thank you everyone!!! All up and running

The Concrete 5 community saves the day once again.

Much appreciated

Alex
tclauset replied on at Permalink Reply
I have the exact same problem with mysql 1062 error, but when I followed your directions, it returned another error message...
Fatal error: Call to undefined method ADODB_mysql::Excecute() in /home3/tclauset/public_html/c5/tools/fixdb.php on line 3


I have not gone into the msql database to try to delete the offending table yet and was wondering if either I messed up the fixdb.php file or if perhaps something is missing that caused the fatal error message.

Here is the modified fixdb.php file that I created from your instructions:

<?php
$db = Loader::db();
$db->Excecute('DELETE FROM PageStatistics WHERE pstID = 32059');
echo 'Deleted record, now delete this file';
?>


Can you suggest a next step for me? Many thanks for your help. It's disconcerting to have your Concrete5 site suddenly dead in the water after days of tweaking its content.
tclauset replied on at Permalink Reply
Fixed the problem by going into myphpadmin and working on the PageStatistics table. When I looked at the table, I did NOT find a duplicate entry, so I "Checked" the table and the message that it returned said the table was corrupted. I then Repaired" the table and received an OK fixed message. The web site loaded fine after this repair work.

Since I've decided to use Google Analytics on the site, I turned OFF the site statistics option for Concrete 5.

Thanks for the discussion above. It was a great help!
dcaryll replied on at Permalink Reply
dcaryll
This worked for me as well. Thanks tclauset!

Some more detailed instructions for beginners like me:

1. Log in to phpMyAdmin
2. Select the PageStatistics table on the left
3. Go to the "Operations" page
4. At the bottom under "Table Maintenance", choose "Check Table".
5. Go back to the same area and "Repair Table".
sumeetwork replied on at Permalink Reply
Nothing on the top worked for be but this repair table worked!! YAY :)

Thanks dcaryll
imJack replied on at Permalink Reply
imJack
I bow to the table God. THANK YOU!
sarvesh replied on at Permalink Reply
What is the process while working on localhost??