Uncategorized

How to Create an Admin Account in WordPress via MySQL in 2018

Sometimes, you need to get access to administrator’s dashboard, but you don’t have active admin’s account.

Here is working code for latest 2018 WordPress versions:

INSERT INTO `PREFIX_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('admin', MD5('admin'), 'firstname lastname', 'email@example.com', '0');

INSERT INTO `PREFIX_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM PREFIX_users), 'PREFIX_capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO `PREFIX_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM PREFIX_users), 'PREFIX_user_level', '10');

Make sure you replaced PREFIX even in meta_key fields.

Leave a Reply

Your email address will not be published. Required fields are marked *