Zen Cart Logo
Forums / General Questions / [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

[Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Views: 10,423

Results 1 to 20 of 69
6 Feb 2013, 2:02 AM
#1
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

[Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

I don't know how long I've been getting these, but I seem to be getting about one a day:
PHP Fatal error: 1062:Duplicate entry 'zc_d6616cb5f4c2cb55d422ea67feb723b0' for key 1 :: insert into db_cache set cache_entry_name = 'zc_d6616cb5f4c2cb55d422ea67feb723b0',

Then, after cache data,

cache_entry_created = '1360021508' in /homepages/5/d232125156/.../store/includes/classes/db/mysql/query_factory.php on line 120

I recently converted this store from 1.3.8 to 1.5.1. (It's possible I've been getting this for years, as I just discovered the logs.) The database upgrade ran fine. Server info:

Server OS: Linux 2.6.28.8-20120713a-iscsi-ntacker-3ware-sec8-fmon-igb-dif2-grsec
Database: MySQL 5.0.96-1~ui60+1
HTTP Server: Apache
PHP Version: 5.2.17 (Zend: 2.2.0)
PHP Memory Limit: 90M PHP Safe Mode: Off
PHP File Uploads: On
Max Size: 40M POST Max Size: 8M
Database Data Size: 15,414 kB
Database Index Size: 4,572 kB

6 Feb 2013, 3:50 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Check your configure.php file for "cache" setting

Is it the database??

I suspect that it is.....

Probably caused from a link that included a zenid

6 Feb 2013, 4:29 PM
#3
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you so much for your prompt response -- you have no idea how much I appreciate it.

Yes, it is set to the database. I often send links, but try to remember to remove the zenid from them. Are you saying it's simply a zenid in a link that I forgot to remove and there's nothing to worry about?

6 Feb 2013, 4:30 PM
#4
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Sorry ... this was a duplicate post caused by my ISP. I sometimes get up to 20 seconds latency and have to refresh, and it causes duplicates. I couldn't figure out how to delete it.

6 Feb 2013, 8:06 PM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Set it to "none" for the time being as see what happens

Check your account for host provided stats and see if you can find where the link is coming from

Yes it appears to be a link that included a zenid

6 Feb 2013, 8:14 PM
#6
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you very much for your prompt reply.

6 Feb 2013, 10:25 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

kobra:

Probably caused from a link that included a zenid
Nope. Won't be related to zenid in the URL.

But truncating the db_cache table might clear up any leftover entries from older versions that might be causing conflicts.

6 Feb 2013, 11:24 PM
#8
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you, DrByte. I have gone into the store manager to confirm cleanup of debug log files, and that didn’t stop it. If you’re referring to something else, I have searched FAQ’s and I can’t figure out what I’m supposed to do. If you could please send me in the right direction, I would appreciate it.

6 Feb 2013, 11:24 PM
#9
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you, DrByte. I have gone into the store manager to confirm cleanup of debug log files, and that didn’t stop it. If you’re referring to something else, I have searched FAQ’s and I can’t figure out what I’m supposed to do. If you could please send me in the right direction, I would appreciate it.

6 Feb 2013, 11:40 PM
#10
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

The FILES in your cache folder are simply REPORTING the error, which exists in your database.

Dr Byte is suggesting you TRUNCATE your db_cache table (that means EMPTY it).

While this can probably be done from your zc admin >>> tools >>> insert sql patches , it is better that it is done in phpMyAdmin (via your hosts c-panel), and only AFTER you have made a full backup of the database.

When working in phpMyAdmin, set your store to maintenance mode.

7 Feb 2013, 12:19 AM
#11
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you, schoolboy. While I differ on the meaning of truncate (to me, it means removing a portion from the end), I just need to know what to do.

I viewed my current db_cache backup with Wordpad and found the INSERT for 2 records. The first was much longer and had the ID of the one in the error message. I then viewed a backup from last year, and it had the same thing, so this is not a new problem.

Are you referring to using PHPMYADMIN and doing a DROP on the db_cache table? I’m sorry, but I’m quite confused. Does Zencart not need that table? I’m sorry, but the last database I worked with was dBase-II, and it is quite simple.

7 Feb 2013, 12:27 AM
#12
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thank you, schoolboy. While I differ on the meaning of truncate (to me, it means removing a portion from the end), I just need to know what to do.

I viewed my current db_cache backup with Wordpad and found the INSERT for 2 records. The first was much longer and had the ID of the one in the error message. I then viewed a backup from last year, and it had the same thing, so this is not a new problem.

Are you referring to using PHPMYADMIN and doing a DROP on the db_cache table? I’m sorry, but I’m quite confused. Does Zencart not need that table? I’m sorry, but the last database I worked with was dBase-II, and it is quite simple.

7 Feb 2013, 2:56 AM
#13
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Are you referring to using PHPMYADMIN and doing a DROP on the db_cache table?
No there should be a selection after checking that table to 'empty' it

Do not drop it

7 Feb 2013, 5:18 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

DROP is a MySQL term for 'delete the table completely'. Bad idea since the system expects the table to be present.

TRUNCATE is a MySQL term for 'remove all the records from the table and reset the table as if it were brand new, including resetting internal pointers/counters to 0'. phpMyAdmin uses the term "Empty" to perform the TRUNCATE statement against the table.
This is NOT the same as manually going into the table and selecting all the records and clicking "Delete", since that doesn't reset any counters.
That is why I used the MySQL term "TRUNCATE" instead of a layman term of "empty" because many people would interpret "empty" as "select each record and click delete" ... which as I said above, doesn't do the reset that TRUNCATE does.

7 Feb 2013, 7:27 AM
#15
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

If you DROPPED the table, you WILL need to re-load it. This is quite easy to do. Just open a copy of the MAIN SQL FILE in a copy of the zc software. It is in the zc_install folder, in sql sub-folder : mysql_zencart.sql

Open it in a PLAIN TEXT EDITOR (crimson editor is good).

FIND:

# --------------------------------------------------------

#
# Table structure for table db_cache
#
DROP TABLE IF EXISTS db_cache;
CREATE TABLE db_cache (
  cache_entry_name varchar(64) NOT NULL default '',
  cache_data mediumblob,
  cache_entry_created int(15) default NULL,
  PRIMARY KEY  (cache_entry_name)
) ENGINE=MyISAM;



# --------------------------------------------------------

.. and run this as a SQL command via phpMyAdmin.

REMEMBER... if your tables have PREFIXES, make sure you include the PREFIX.

--------------------------------------------------------

Table structure for table db_cache

DROP TABLE IF EXISTS **PREFIX_**db_cache;
CREATE TABLE **PREFIX_**db_cache (
cache_entry_name varchar(64) NOT NULL default '',
cache_data mediumblob,
cache_entry_created int(15) default NULL,
PRIMARY KEY (cache_entry_name)
) ENGINE=MyISAM;

--------------------------------------------------------

7 Feb 2013, 8:00 AM
#16
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

And a final point... you will appreciate that helpers on the forum almost always use correct taxonomy to describe issues. This is critical to the appropriate remedy being advocated.

So for example, if a person seeking advice does not know what TRUNCATE means when working with MySQL the "duty of care" he/she has, is to go find out what it means.

7 Feb 2013, 3:27 PM
#17
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Thanks to all of you; I'll give it a try. As for terminology, that's why I asked for clarification. I spent 20 years working with mainframes, and I learned not to guess. (And, in mainframes, truncate means to remove off the end.) My PHPMYADMIN options are "drop," "empty," "print view," "check table," "optimize table," "repair table," and "analyze table." As soon as a I get a chance, I'll try the "empty" option ... after going into maintenance mode and making 2 backups.

Some of us need advice on a lower-level, as we don't work with zen-cart often. There was once a banner that said, "If you have to think, you haven't been zenned." I'm one who has to think, to seek advice, and to ensure I understand it properly before jumping off a cliff. After spending 5 days where my problem was that I wasn't signing on with the original userid so I wasn't a Superuser, I treat Zen-cart cautiously. I still have to force my server to PHP 5.4 to ensure everything works okay, as my server's deadline is 3/31.

Thanks especially to DrByte, who clarified the "empty" option is what I need to do in order to "truncate." I'll give it a try. I also apologize for duplicate posts. My browser doesn't seem to like something with the forums -- I get a message about leaving the page, and then it posts a duplicate. I haven't figured out how to delete a post, yet.

6 Mar 2013, 4:06 PM
#18
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

PHP 5.4. Receiving an error message in my cache folder (I was previously receiving a similar message, but did an “empty” on the db_cache folder, and the message has changed). Ajeh responded to a somewhat similar error for someone else, but it appeared to be for table prefixes, which I don’t use.

[06-Mar-2013 04:28:16 America/New_York] PHP Fatal error: 1062:Duplicate entry 'zc_d6616cb5f4c2cb55d422ea67feb723b0' for key 1 :: insert into db_cache set cache_entry_name = 'zc_d6616cb5f4c2cb55d422ea67feb723b0',

cache_entry_created = '1362562096' in /homepages/5/d232125156/htdocs/reliablegokarts.com/store/includes/classes/db/mysql/query_factory.php on line 120

Line 120 is “ trigger_error($this->error_number . ':' . $this->error_text . ' :: ' . $this->zf_sql, E_USER_ERROR); “

6 Mar 2013, 11:54 PM
#19
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

I truncated the db_cache file, but I'm still getting the same error. Here is a backup of my database for db_cache (the data that was there is gone):
-- Table structure for table db_cache

DROP TABLE IF EXISTS db_cache;
CREATE TABLE db_cache (
cache_entry_name varchar(64) NOT NULL default '',
cache_data mediumblob,
cache_entry_created int(15) default NULL,
PRIMARY KEY (cache_entry_name)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table db_cache


6 Mar 2013, 11:56 PM
#20
rayw1679 avatar

rayw1679

Zen Follower

Join Date:
Mar 2005
Location:
Waxahachie, Texas
Posts:
172
Plugin Contributions:
0

Re: [Done v1.6.0] 1062:Duplicate entry for key 1 in db_cache

Sorry ... another duplicate entry. I don't know why that sometimes happens.