If you lose your administrator credentials and need to create a new admin in WordPress via phpMyAdmin...
Log into phpMyAdmin and click on the users table (usually wp_users).
For this reference, I will use the table prefix, wp_, but this could be different for your particular install. If the user table is cas_users, for example, change wp_ to cas_.
- ID – pick a number (in our example, we will use the number 4).
- 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).
- Click on the Go Button
Now click on the table, wp_usermeta and follow these instructions...
- 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. Remember we picked 4.
- meta_key – this should be wp_capabilities
- meta_value – insert this: a:1:{s:13:"administrator";b: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. Remember we picked 4.
- meta_key – this should be wp_user_level
- meta_value – 10
You'll need to log in now to the WordPress administration, click on the user that you just created, and click save. That will fill in any missing field data in the table.
Comments