Nội dung
Surely many users have had the ironic problem that their website one day was attacked by a hacker or infected with malicious code and deleted all WordPress admin account information, or it could be the user themself accidentally deleted this information. So, what should you do if you accidentally fall into one of the above situations and cannot log in to the website administration page anymore? Don’t worry, you can refer to this article to learn how to solve it.
Step 1: Access phpMyadmin on your Hosting/VPS
Step 2: Copy and paste the account creation code
At phpMyadmin, you choose the correct database of the website (1) => select SQL (2).
Copy the code below and paste it into Run SQL query/queries on database.
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) VALUES ('admin
', MD5('password
'), 'your name
', 'admin@abc.xyz
', '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');
In the above code, you need to replace some places with your information as follows:
- admin: replace with a new user to create
- password: replace the new password to create
- your name: replace with your Username
- admin@abc.xyz: replace with your admin email information
Note: The above code uses default WordPress information, so the tables in the database will bewp_ . You need to check the database prefix on your website and replace it correctly according to the instructions below.
So my prefix is wp1m_ => in the above code, if there is wp_ in the above code, I will replace it with wp1m_. And specifically as below:
After entering all the information, click Go running the command.
Run the command successfully, you will get the information:
Now you access the website admin and try to login with the information you just created, I’ve done it successfully.
Bugs
After completing the above steps, if you still cannot log in to the website administrator, you need to download the wp-reset-user.php file and upload it to the folder containing the website source code. Then you access yourdomain/wp-reset-user.php so that the website automatically updates user permissions. The screen shows below the completion of the update. Now please check if you have successfully logged in.
Summary
Thus, AZDIGI has shown you a way to create an admin account manually through phpMyadmin, this will help you in creating a new admin account. If you find this helpful article, please share it widely.
Wishing you success!
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You can use your email to register for the service and send it directly to: support@azdigi.com