Top Left Text cha

Web & App Development

I found this article by searching Google on how to insert an administrator into the database, but it had some bad and incomplete information in it so I just basically 'fixed' the bad info and posted it here.

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_.

  1. ID – pick a number (in our example, we will use the number 4).
  2. user_login – insert the username you want to use to access the WordPress Dashboard.
  3. user_pass – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
  4. user_nicename – put a nickname or something else that you would like to refer yourself as.
  5. user_email – add the email you want to associate with this account.
  6. user_url – this would be the url to your website.
  7. user_registered – select the date/time for when this user is registered.
  8. user_status – set this to 0.
  9. display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
  10. Click on the Go Button


Now click on the table, wp_usermeta and follow these instructions...

  1. unmeta_id – leave this blank (it will be auto-generated)
  2. user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  3. meta_key – this should be wp_capabilities
  4. meta_value – insert this: a:1:{s:13:"administrator";b:1;}
  5. Insert another row with the following information:
  6. unmeta_id – leave this blank (it will be auto-generated)
  7. user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  8. meta_key – this should be wp_user_level
  9. 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.

Add comment


Security code
Refresh

  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X