Create an Admin account in WordPress via MySQL

0
370
views
WordPress admin login

So locked out of your WordPress site? Your customer forgot their password?
No worries it’s an easy fix when it comes to  WordPress and having access to your phpMyAdmin (Adminer or even SSH access) on your hosting package.

Simply login to your phpMyAdmin, find the database that is used by your site (if you don’t know what it is just check your wp-config.php under DB), click SQL and input the following code:

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newusername', MD5('newpassword'), 'firstname lastname', '[email protected]', '0');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

Be sure to change the code in red to your preferences.

There we go, now login with your new credentials and enjoy.


P.S. Be sure that the wp_ is the correct prefix for your database. If not just change all wp_ to your prefix.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.