RESOLVED: Error: #1062 - Duplicate entry '1' for key 1

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
tmguchi
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Apr 20, 2010 2:14 am

RESOLVED: Error: #1062 - Duplicate entry '1' for key 1

Post by tmguchi » Fri Apr 23, 2010 3:26 am

I searched the forums and it appears others get this error during migration/upgrading to Joomla 1.5. My error is occurring when I try to update the database.

I was able to successfull export the db from my localhost and import it using phpmyadmin the first time, but now every subsequent time I try to import I get the following error:
Error
SQL query:

--
-- Dumping data for table `jos_categories`
--
INSERT INTO `jos_categories` ( `id` , `parent_id` , `title` , `name` , `alias` , `image` , `section` , `image_position` , `description` , `published` , `checked_out` , `checked_out_time` , `editor` , `ordering` , `access` , `count` , `params` )
VALUES ( 1, 0, 'Random Quotes', '', 'random-quotes', '', '1', 'left', '', 1, 0, '0000-00-00 00:00:00', NULL , 1, 0, 0, '' ) , ( 2, 0, 'Introduction', '', 'introduction', '', '1', 'left', '', 1, 0, '0000-00-00 00:00:00', NULL , 2, 0, 0, '' ) , ( 3, 0, 'Latest Updates', '', 'latest-updates', '', '1', 'left', '', 1, 0, '0000-00-00 00:00:00', NULL , 3, 0, 0, '' ) , ( 4, 0, 'Personal', '', 'personal', '', 'com_contact_details', 'left', '', 1, 0, '0000-00-00 00:00:00', NULL , 1, 0, 0, '' ) ;

MySQL said:

#1062 - Duplicate entry '1' for key 1
I have checked the jos_categories table and "Add AUTO_INCREMENT" value is on.

TIA

* - looking over the categories I'm not sure if this should go in the "General" or "Installation" category. Installing Joomla onto my host is complete and the site is running fine. It's only the updating of the SQL that is giving me problems.
Last edited by tmguchi on Fri Apr 23, 2010 2:35 pm, edited 1 time in total.

User avatar
RussW
Joomla! Exemplar
Joomla! Exemplar
Posts: 9347
Joined: Sun Oct 22, 2006 4:42 am
Location: Sunshine Coast, Queensland, Australia
Contact:

Re: Error: #1062 - Duplicate entry '1' for key 1

Post by RussW » Fri Apr 23, 2010 4:09 am

If you are over-writing an existing DB, you will need the export to be set for "DROP IF EXIST" or manually drop the previous database before trying to import the new one.
Joomla! on the fabulous Sunshine Coast...
hotmango, web & print http://www.hotmango.me/
The Styleguyz https://www.thestyleguyz.com/

tmguchi
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Apr 20, 2010 2:14 am

Re: Error: #1062 - Duplicate entry '1' for key 1

Post by tmguchi » Fri Apr 23, 2010 2:35 pm

Thanks so much. That's what it was.

How many hours could have been saved. SIGH.

unleash_it
Joomla! Ace
Joomla! Ace
Posts: 1311
Joined: Wed Nov 05, 2008 11:28 pm

Re: RESOLVED: Error: #1062 - Duplicate entry '1' for key 1

Post by unleash_it » Wed Jun 02, 2010 11:54 pm

hi there i have the same error - i cannot help myself

plz advice - i have it with the session

Well to be precise: my friends i have serious problems with the Joomla 1.6 Beta 1 and 2

The installment runs well on the system: but if i want to log in i get the serious error:

Code: Select all

INSERT INTO `jos_session` (`session_id`, `client_id`, `guest`, `time`, `data`, `userid`, `username`, `usertype`) VALUES
('2e13a6979686d297d8b0225e9dc09626', 0, 1, '1275497933', NULL, 0, '', '');
well what can i do here: i tried several versions - Joomla 1.6 Beta 1 and 2.
Everytime it is the same.

i tried to fix the db

1. repair the table from Cpanel.
2. From command line:

Quote:
mysql> use databasename;
mysql> REPAIR TABLE jos_session;


Well, repairing table did not play the trick then some one advided me that i
can delete the table and create it by firing the below sql query to create the table:

Code: Select all

CREATE TABLE IF NOT EXISTS `jos_session` (
`username` varchar(50) default '',
`time` varchar(14) default '',
`session_id` varchar(200) NOT NULL default '0',
`guest` tinyint(4) default '1',
`userid` int(11) default '0',
`usertype` varchar(50) default '',
`gid` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`session_id`),
KEY `whosonline` (`guest`,`usertype`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
see more for the fix here: http://www.fasthostinghelp.com/joomla-e ... c4554d731e&

Error while accessing Joomla Site:

Well i did not do this untill now. The db-dumps look a bit different.
See more infos: this is the original

Code: Select all

-- table `jos_session`
--

DROP TABLE IF EXISTS `jos_session`;
CREATE TABLE IF NOT EXISTS `jos_session` (
  `session_id` varchar(32) NOT NULL default '',
  `client_id` tinyint(3) unsigned NOT NULL default '0',
  `guest` tinyint(4) unsigned default '1',
  `time` varchar(14) default '',
  `data` varchar(20480) default NULL,
  `userid` int(11) default '0',
  `username` varchar(150) default '',
  `usertype` varchar(50) default '',
  PRIMARY KEY  (`session_id`),
  KEY `whosonline` (`guest`,`usertype`),
  KEY `userid` (`userid`),
  KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Data for Tabelle `jos_session`
--

does it have to do with the mysql db - settings!? i do not know!?`see more here:

20.25. The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables


The GLOBAL_VARIABLES and SESSION_VARIABLES tables provide information about server status variables. Their contents correspond to the information produced by the SHOW GLOBAL VARIABLES and SHOW SESSION VARIABLES statements (see Section 12.4.5.41, “SHOW VARIABLES Syntax”).
INFORMATION_SCHEMA Name SHOW Name Remarks
VARIABLE_NAME Variable_name
VARIABLE_VALUE Value

Notes:
The GLOBAL_VARIABLES and SESSION_VARIABLES tables were added in MySQL 5.1.12.
Beginning with MySQL 5.1.19, the VARIABLE_VALUE column for each of these tables is defined as VARCHAR(20480). Previously, this column had the data type LONGTEXT; this was changed in order to make these tables consistent with the GLOBAL_STATUS and SESSION_STATUS tables, whose definitions had been changed in that version (see Section 20.24, “The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables”).
You do not have the required permissions to view the files attached to this post.
regards un-leash,
a big fan for ++ 11 years now: With Joomla you can easily create and extend your website: see the site, that offers you ideas & modules - extensions.joomla.org - it lists over 4000 extensions


Locked

Return to “Administration 1.5”