Change WordPress User role from Database using PHPMyAdmin

Change WordPress User role from Database using PHPMyAdmin, You can update any WordPress user information like changing user role and updating an email from admin panel. But if you want to update or change an user role from MySQL database using PHPMyAdmin or SQL, you can do that. Before making any changes to user role, you need to get user id which you want to update user role.

For updating user role you need to have user id, then you need to access wp_usermeta table.

In wp_usermeta table, you can find wp_capabilities under meta_key. And find wp_capabilities with same user id for which you want to update.

From this screenshot, you can understand, what you need to select using query or what you need to search using PHPMyAdmin.

Change WordPress User role from Database using PHPMyAdmin

wp_usermeta table and data for wp_capabilities

In the field of meta_value, the value should be a:1:{s:13:”administrator”;b:1;}

Below is SQL for updating an user role as administrator. Here I’m assuming user id as 2.

UPDATE <code>wp_usermeta</code> SET meta_value='a:1:{s:13:&quot;administrator&quot;;b:1;}' WHERE user_id=2 AND meta_key='wp_capabilities'

You can use above sql to update user role in any WordPress website but just change the user id with the actual user id you can update the user role for.

Incoming search terms:

  • change user table wordpress
  • filetype sql intext:wp_users phpmyadmin
  • how can i make user admin in wp database
Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe