Created
March 23, 2015 08:20
-
-
Save janikvonrotz/25d9f243fc20532cb1b5 to your computer and use it in GitHub Desktop.
Wordpress add administrator user with sql only
#WordPress
#MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE <database>; | |
SET @username = '<username>'; | |
SET @password = MD5('<password>'); | |
SET @fullname = '<Firstname Lastname>'; | |
SET @email = '<login@example.com>'; | |
SET @url = '<http://example.com/>'; | |
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`) VALUES (@username, @password, @fullname, @email, @url, NOW(), '0', @fullname); | |
SET @userid = LAST_INSERT_ID(); | |
INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@userid, 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
INSERT INTO `wp_usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES (@userid, 'wp_user_level', '10'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment