Recently, when I was playing with the multisite feature of WordPress I came across this error
WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO
meta_value) VALUES (1, 'primary_blog', '1') made by require_once('wp-admin/network/admin.php'), require_once('wp-admin/admin.php'), do_action('admin_init'), WP_Hook->do_action, WP_Hook->apply_filters, _wp_admin_bar_init, WP_Admin_Bar->initialize, get_active_blog_for_user, update_user_meta, update_metadata, add_metadata
I understand that there is some problem in the database table wp_usermeta.
Well, actually what I was trying to do is to convert my present wordpress single site to multisite. And during this process I suddenly started getting this error.
I tried Googling and came across to use phpMyAdmin to repair my table
REPAIR TABLE wp_usermeta
but unfortunately, it didn’t work for me.
I rather tried to set auto-increment to the Primary key of the table.
To do this, open phpMyAdmin. Then open table wp_usermeta
After that click on Structure and then click on Change next to the primary key i.e. umeta_id
Press the check mark on AI and click on Save.
And Voila… It fixed my problem. Hopefully it works for others too. Let me know about it.