Add User to WordPress DB with SQL

October 20, 2021
Code Category:

This will add an admin account to the WordPress database. To do so, you have to be able to run SQL against the database server, so, from your hosting control panel using something like phpMyAdmin.

Steps

  1. Fix the table prefix everywhere the table is being called. (wp_users, wp_usermeta...)
  2. Add a real password that you can remember (don't leave 'password123')
  3. Replace my name, email and user name
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`,`user_status`) VALUES ('fotan', MD5('password123'), 'Matt Danskine', '[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');
©2021 Fotan Web Design