I’ve just had this query from a client – well more that he had a site that was out of date and was showing errors (from a host who had upgraded the version of php and the version of WP the client was running was showing up deprecated errors.) So I said I would sort it out for him – but the name & password that had worked before was simply not working for me.
Time for some drastic action.
I knew that all it takes to create a new user in the wp_users table in thr database (and I had full phpMyAdmin access)
so I found this excellent article on how to add admin users here:
http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/
Essentially it boils down to running these 3 lines of MySQL:
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('999', 'newusername', MD5('newpassword'), 'Laura James', 'laura@yourdomain.com', '', '2014-06-07 00:00:00', '', '0', 'Laura James');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '999', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '999', 'wp_user_level', '10');
Then you should be able to login with the following user name & password
newusername
newpassword
Note: It does show how it is so important to lock down direct access to your MySQL database when running WordPress as anyone who has this access can easily create new admin users for your WP install.