New WordPress admin user over SQL phpMyAdmin
How to make user over FTP is here.
You will need:
- Access to wp-config.php because it contains the database host, username, and password.
- Access to phpMyAdmin (if it is ‘localhost’, you will need to investigate the address).
You don’t need:
- Access to the WordPress dashboard for creating a new admin user :)
After logging into phpMyAdmin, click on the SQL tab and paste the following snippet. It will create a new admin user with the login name newadmin and password newadmin:
INSERT INTO `w_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('newadmin'), 'newadmin', 'any@email.com', '0');
INSERT INTO `w_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM w_users), 'w_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `w_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM w_users), 'w_user_level', '10');
The w_ is a table prefix. Change it to match the prefix you are using.
After gaining access to the site, you can do anything.
Security recommendations:
- Keep your FTP access secure with a long password, or disable FTP access if you don’t need it.
- Keep file attributes strict for the wp-config.php file; use 640 or 644.