DB-error - Matomo not working

Hello!
This is my first post - so please bear with me if I do anything wrong here in the forum ;-).
I have the following problem. I have successfully installed Matomo on Premise in my WordPress-website. Everything worked fine until I added a new administrator.
When I try to open Matomo with this new admin account, I either get the message that there is a fatal error or I get the following message when I call the reports: WP DB Error: [1062] Duplicate entry ‘admin-name’ for key ‘uniq_email’.
However, all other plugins and the website continue to work.
With the “original” admin account, i.e., the account with which I installed Matomo, Matomo continues to run without issues. However, I want to remove this account.
I hope you can help me to solve this problem.
Thank you very much!
Markus

Some more information:
Active theme: Astra Child Theme (version 1.0.0)
Current plugin: Matomo Analytics - Ethical Stats. Powerful Insights. (version 4.12.0)
PHP version 8.0.20 Error Details =============

An error of type E_ERROR was caused in line 407 of the file /www/htdocs/w01d36f6/xyz.com/wp-content/plugins/matomo/classes/WpMatomo/Db/WordPress.php. Error message: Uncaught Zend_Db_Statement_Exception: WP DB Error: [1062] Duplicate entry ’ for key ‘uniq_email’ in /www/htdocs/w01d36f6/xyz.com/wp-content/plugins/matomo/classes/WpMatomo/Db/WordPress.php:407

I do not find any duplicate email-addresses on WordPress - user table or Matomo user table.

I hope, that helps!
Kind Regards, Markus

Hey Markus,

I’m sorry to hear you are having issues.

It sounds like an error with the users somehow.

Could you please try to re-sync your users by:
In the Wordpress backend click Matomo Analytics > Diagnostics > Troubleshooting > Sync users

Please let me know how you go.

Kind Regards,
Lance

Hi Lance!

Thank you for your response.
Unfortunately, the same error occurs by trying to sync the users.

Kind Regards, Markus

Hey Markus,

It sounds like it is trying to re-create a user that is already in there, I’m not sure why exactly but one thing you could try is deleting all the users in the matomo_user table then running that “Sync users” again to pull them all back across.
So in your database run:
SELECT * FROM wp_matomo_user; (with the correct table prefix)
Copy the results, just in case.
DELETE FROM wp_matomo_user;
Then click the “Sync users” button again.

If this fails could you please check again the users in the wp_users table for duplicate emails:
SELECT user_email FROM wp_users;

Please let me know how you go.

Kind Regards,
Lance

Hi Lance!

That worked - thank you.
I tried to add a new Admin user, too. That also worked.

I have no clue what causes the problems. But now I’m happy, and we’ll start our Matomo - journey right now!

Thank you!
Kind Regards, Markus

hello
We had the problem.
We just had used iThemes Security to change the ID of first admin to another ID. :slight_smile: for security reasons.
We had to move the plugin outside of Plugins, then to remove the user in wp_matomo_user.
thank you