Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2011 13:46
What would you like to do?
Add Admin-User in WordPress via 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 ('99', 'my_login_name', MD5('my_password'), 'My Name', '', '', '2011-06-09 00:00:00', '', '0', 'display_name');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '99', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '99', 'wp_user_level', '10');
Copy link

I think it's also helpful to note that if people use or alter the prefix in the WP-Config that they must change the wp_ to whatever their prefix is now. Otherwise none of this stuff is very useful to those who choose to insert a special prefix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment