Sometimes you may need to create yourself a new WordPress administrator, you also may not have access to a GUI such as PHPMyAdmin or simply prefer using the command line (because its faster).
In which case, you can follow the below steps, please remember to adjust the commands with your database and user credentials.
1. SSH to your hosting server.
2. Login to MySQL using the below command, enter your password when prompted:
mysql -u mysql_username -p;
3. Change into your database:
use database_name;
4. Now update the below command to include your preferred user details and email address and then issue:
insert into wp_users (user_login,user_pass, user_nicename,user_email,user_url,user_registered,user_activation_key,user_status,display_name) values ('username','','username','your@emailaddress.com','','2020-02-11 09:43','',0,'Username');
5. To assign administrative permissions, you will need to identify your users ID number, so issue the below command to show all table contents and make note of the ID number of your created user:
SELECT * FROM wp_users;
6. The below command will assign your user administrative privileges, make sure to update the command with your user ID, in our example, the user ID is the number 4:
insert into wp_usermeta (user_id, meta_key, meta_value) values (4,'wp_capabilities','a:1:{s:6:"administrator";b:1;} ');
Now to gain access, you can go to /wp-admin and request a password reset.
Comments
0 comments
Please sign in to leave a comment.