When working with WordPress, you sometimes get all the information you need, hosting access, FTP(s), Git repository but you don’t have access to the main WordPress dashboard. For many reasons, you don’t want to wait for them to create you an administrator account. If you are in this situation, you can create an account via phpMyAdmin. We use WPEngine for the majority of our clients and phpMyAdmin can be found in your dashboard on the left sidebar.
- Log in phpMyAdmin
- Once the first screen appears, select your database from the left sidebar. Usually is called
wp_your-db-name
- On the top navigation, select SQL
-
Now you should have the SQL editor where you will add the SQL code to create your new administrator account. You need to replace
change_password
,firstname lastname
andemail@example.com
.INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('newadmin', MD5('change_password'), 'firstname lastname', 'email@example.com', '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";b: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');
- After you replaced the default values, press Go in the right bottom corner. The query will run and a message “1 row affected” will be displayed.
What if I want to create a different type of user?
If you want to create a different type of users, you have to replace the the value in the 3 row.
- Admin wp_capabilities wp_user_level 10:
a:1:{s:13:"administrator";b:1;}
- Contributor wp_capabilities wp_user_level 1:
a:1:{s:11:"contributor";b:1;}
- Editor wp_capabilities wp_user_level 7:
a:1:{s:6:"editor";b:1;}
- Author wp_capabilities wp_user_level 2:
a:1:{s:6:"author";b:1;}
- Subscriber wp_capabilities wp_user_level 0:
a:1:{s:10:"subscriber";b:1;}