How to create an Administrator user via MySQL – WordPress

Have you ever needed to create a new user in WordPress through MySQL?

It's more common than you thing. A new client comes in and he already has a WordPress site. You want to create your account and you just don't want to bother him asking for his user and password.

Here's the three queries that will create a new user with Administrator role.

Username: demo
Password: demo

Customize it with your name or email to fit your needs πŸ˜‰

INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', '', '', '2011-06-07 00:00:00', '', '0', 'Your Name'); INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');

Leave a Reply

Add <code> Some Code </code> by using this tags.