Skip to main content

Solution for: 1062 Duplicate sql entry error while updating to Joomla 3.6.

| Andrzej Herzberg | Joomla Templates

In this tutorial I would like to show you how to solve most common issue that may appear when updating to Joomla 3.6. The same problem appeared while we had been in the middle of our templates update so we created a script that helped us a lot. Now we want to share it with you. The database fix script has been tested on over 80 Joomla! installations on our servers.

duplicate entry joomla 3.6 update

1062 Duplicate entry '802' for key 'PRIMARY' SQL=INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES (802, 'English (United Kingdom)', 'package', 'pkg_en-GB', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0);

What happened?

In short, one of your plugins uses the extension ID 802 which should be used only by Joomla! core plugins. For some reason the SQL AUTO_INCREMENT 10000 on #__extensions table does not work. All IDs below 10000 are reserved for Joomla! and 3rd party (additonal) plugins should NOT use them.

How to solve this issue?

That's quite easy with our script. But at first, remember to make backup of your Joomla! installation. You can use for example Akeeba Backup extension for this purpose. You will find package at Joomla Extensions Directory

1. Create backup of your site!!!

2. Download fix script.

3. Unizp package (do NOT install it via Extensions Manager!).

Using your favourite FTP client upload file 'jmdbfix.php' to your Joomla root directory.


4. Now you should be able to follow this address:

Be carefull, incorrect usage of script may crash your Joomla.

table with plugins

On this page you will see large table with plugins currently installed on your Joomla!.
All plugins marked with red background are core Joomla plugins, which basically you should not touch at all.

Green cells includes items which you should take a closer look, in most cases these should be external plugins which have incorrect ID, what you can check in 'extension_id' column.

incorrect plugin id

As you can see ID 802 is taked by plugin 'FOF (NEW) ...', which causes the problem. Of course ID can be taken by any other plugin, this is just example.

5. Now you need to fix issue. It is simple, just click 'Move' button.

Make sure you are moving ONLY plugins with green background and ONLY plugins which really are NOT core Joomla! plugins.
Function will change plugin ID to correct value (larger than 9999).

fixing extension id

You should repeat the same operation also for other items with green background (not core Joomla! plugins).

After that, your table should look as follows:

correct plugins id

This is correct! Only Joomla! Core plugins listed what mean that all 3rd party plugins have proper IDs.
Now, all you have to do is to remove file 'jmdbfix.php' from your Joomla root directory and update / re-update Joomla! :)

Still have error?

duplicate entry 453

1062 Duplicate entry '453' for key 'PRIMARY' SQL=INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES (453, 'plg_editors-xtd_module', 'plugin', 'module', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0);

Remember to Fix database before the update or before using reinstall Joomla core files function.

Go to Backend -> Extensions -> Manage -> Database and click Fix button.
Now you can update Joomla without a problem :)

update to j36

[Update 26.07.2017]

Thank you, @Keith Harris for your comment! You're right, I should mention that after the fixing process the file root/jmdbfix.php should be removed. 

Like it? Please share it. Thanks!