I can't login to the admin dashboard. When I go to localhost/nutri/wp-admin, it automatically redirects me to:

```
http://localhost/nutri/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2Fnutri%2Fwp-admin%2F&reauth=1

```

and when I try to login, it just redirects me back to that same URL. It doesn't give any error message on the screen. If I try to login with incorrect details, then it does give the usual incorrect username or password message, so this isn't a problem with the login details. 

WP\_DEBUG is on but no error messages are appearing on the screen. But a new error appears in error\_log.php every time I try to login:

> 
> [01-Oct-2016 22:01:31 UTC] WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (31, 'session\_tokens', 'a:1:{s:64:\"430df13e6700f4ec995ca5f4eb5901886b39db5225975bcef392002b27173629\";a:4:{s:10:\"expiration\";i:1475532091;s:2:\"ip\";s:3:\"::1\";s:2:\"ua\";s:73:\"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0\";s:5:\"login\";i:1475359291;}}') made by wp\_signon, wp\_set\_auth\_cookie, WP\_Session\_Tokens->create, WP\_Session\_Tokens->update, WP\_User\_Meta\_Session\_Tokens->update\_session, WP\_User\_Meta\_Session\_Tokens->update\_sessions, update\_user\_meta, update\_metadata, add\_metadata
> 
> 
> 

Yesterday I added a new member through the admin dashboard, and today when I went into the wp\_users table in phpmyadmin (to try manually resetting my password) and I noticed that the new user I entered had an ID of 0. I deleted that row. Today I tried registering a new account through my registration form. The new account again had an ID of 0. If I delete it, and register a new user, the same thing happens:
<https://i.gyazo.com/c3daabb414f620f1b6c11c1d199a1d39.png>

If I try adding a new user without deleting the ID=0 account, I get this error message on screen:

> 
> WordPress database error: [Duplicate entry '0' for key 'PRIMARY']
>  INSERT INTO `wp_users` (`user_pass`, `user_email`, `user_url`, `user_nicename`, `display_name`, `user_registered`, `user_login`) VALUES ('$P$Bj1pCG4T8VksjjeeD.dx8Qu0p9l7RT.', 'root@ftes.com', '', 'rootftes-com', 'root@ftes.com', '2016-10-01 21:48:42', 'root@ftes.com')
> 
> 
> 

I tried disabling all plugins and I tried deactivating the theme but none of that worked. I tried installing a fresh version of wp-login.php. 

So the issue is something to do with the wp\_users table but I don't know how to further diagnose or fix this. It works fine on the live server, but I'm afraid to upload my changes now in case it breaks the live site.