Here’s the Story
The platform is WordPress, and you’ve been given the task to make some edits on the website. Before you can proceed, you need administrator credentials to log in. However the only thing you were given is the login credentials for CPanel.
Does this sound familiar to you? You may have come across the same issue and have not been able to proceed. However, I’ve this resolved through my own experience and I’m here to share the solution with you.
The Solution
For starters, you should be able to connect to the database via phpmyadmin, adminer, command line, etc. Once you’re in (Ill explain with phpmyadmin), we will be making changes to the wp_users and wp_usermeta tables. We’ll need to insert our new admin user’s information. Use the settings below and make sure user_pass is set to MD5.
- ID – leave empty.
- user_login – insert the username you want to use to access the WordPress Dashboard.
- user_pass – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
- user_nicename – put a nickname or something else that you would like to refer yourself as.
- user_email – add the email you want to associate with this account.
- user_url – this would be the url to your website.
- user_registered – select the date/time for when this user is registered.
- user_status – set this to 0.
- display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
Next, we’re going to add the values to wp_usermeta table. Add the following information to the insert form:
- unmeta_id – leave this blank (it will be auto-generated)
- user_id – this will be the ID of the user you created in the previous step.
- meta_key – this should be wp_capabilities
- meta_value – insert this: a:1:{s:13:”administrator”;s:1:”1″;}
Insert another row with the following information:
- unmeta_id – leave this blank (it will be auto-generated)
- user_id – this will be the ID of the user you created in the previous step.
- meta_key – this should be wp_user_level
- meta_value – 10
Problem Solved
Now you should be able to login to your wp-admin with the username and password you specified for this user. Once you’ve logged in, click on ‘Users’ and edit the username you just created. Go down and click on the Save button (you don’t have to change anything). This will allow WordPress to go through and add some more information and clean-up the user we just added.
I hope this solution helps you whenever you come across this issue.