How to create an admin account in WordPress via MySQL?

1. Log in to your cPanel account from the top navigation menu. Select phpMyAdmin from the Databases section of the cPanel menu.

2. Select your WordPress database from the list presented in the left sidebar. 

3. In the right pane, click the SQL button.

4. Enter the following code in the box labeled Run SQL query/queries on the database. This code creates a new administrator account with the following credentials:

  • Username: admin01
  • Password: password01

5. Change these credentials in the code to your own selection.

 INSERT INTO 'wp_users' ('user_login', 'user_pass', 'user_nicename', 'user_email', 
'user_status')
 VALUES ('admin01', MD5('password01'), '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";s:1:"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');

6. Click the Go button to run the query.

7. Now head to the WordPress administration dashboard and try to log in with the newly created credentials.


For any support, visit 
hire our experts. 

Was this answer helpful? 0 Users Found This Useful (0 Votes)