Update error solved: Error SQL Duplicate entry for key 'idx_username'

The recent release of Joomla 3.9.16 includes the addition of a database index to the users table. If your Joomla website happens to have duplicate usernames, this index addition will fail and you will see an error as in the attached image. The rest of the update will typically suceed just fine. 

Should you have this error, you must first find and solve the duplicate username problems. Each username in your site should be unique, so you should either rename or remove duplicates. 

To find the duplicates you can run the folowing MySQL command (replace #_ with the prefix for your tables)

SELECT username FROM #__users GROUP BY username HAVING COUNT(*) > 1

Once you have solved that, then you can navigate to the database fix function and run it to add the missed index. To do that navigate to Extensions > Manage > Database and click the 'Fix' button.

If you experience any issues with this fix, please feel free to get in touch!

Last modified onThursday, 12 March 2020 15:35
Joomla Expert

JoomlaExpert offers a full range of specialist Joomla website packages coupled with professional Joomla advice & long term support. With clients based in the UK, Scotland, Republic of Ireland, Northern Ireland, the United States, Canada and and Australia we work with a diverse range of businesses providing world-class Joomla solutions. With specialist partners in Marketing, Graphic Design, Video Production, Hosting & Development, we manage your Joomla projects from end-to-end. 

Dr. Ultan Sharkey (BBLS, MBS, Ph.D.) is an ecommerce consultant specializing in online shopping businesses. He holds a Masters degree in Ecommerce and a PhD in Online Shopping Experience from National University of Ireland Galway where he is also an Adjunct Lecturer in the business school. He also owns www.barefoot.ie, a Joomla based online shop for top-brand fitness equipment. He is also a founding member of the eCommerce Association of Ireland (www.ecai.ie).

Ultan and his team have over 10 years experience with Joomla having worked with it since it forked from the Mambo CMS back in 2005. 

Facebook  Twitter  Linkedin

Need Joomla Help? Get a free professional assessment!

Free Joomla Assessment

Contact us

Need a Joomla Expert?