Dr Sushil Kumar

MySQL Insert: Admin Account Deleted from Database?

database, MySQL, phpMyAdmin, wordpress

Last updated on Sunday, March 1st, 2020

MySQL Insert in phpMyadmin

I am not a web developer or a programmer but using WordPress since 2015 for my blogging interests. Today what I did? I found many spam users in the account. I thought to delete all users that are more than 12000. First I started to delete from the WordPress admin panel. But it was difficult to delete all at once. So, I went at the phpMyAdmin account and clicked the database files and started to find wp_user files.

My common sense indicates that this may be user-related data. I just clicked the file and observed it. I found all the info.  Started to delete the data selecting 2000 cells at once.

my user files

In this process, I forget my credentials and deleted my admin account from the database together with other users (subscribers) of WordPress.

It realized me when on WordPress wp_admin.php page appear for login. I with some doubt typed my user name and password. But the account already was lost.

So I went my Godaddy account from there I have taken hosting for WordPress. Login in my Pro account and started to check the status.

When I did try to restore from it, an error comes due to administration in word press.

godaddy admin pageFrom the above picture, you can understand how I suffered? The restore option gave the error and I couldn’t be successful. No option worked here like as optional administrator too. Then I look forward again towards the database.

mysql insert file

Field and their values

Here, in my phpMyAdmin, again click the file first which is highlighted in the first picture. The table of wp_users and open the MySQL insert. This you can see here in the above picture. The insert tab is encircled.

Now the point about the field and their values which you have to field. This thing can be initiated when someone hacks the website and deletes your credentials from the database.

In the MySQL insert fields, you have to submit various fields that are given below. In your database click:

wp_users that includes these fields;

‘USER_ID’ – pick any number that is not included in the database for any other users, for example, 1204

user_login – insert your username to access the WordPress Dashboard.
user_pass – Give a password.
user_nicename – Suggest a nickname that you like.
user_email – add the email id that you will use for the admin purposes.
user_url – Enter the URL of your website.
user_registered – Mention the date/time for when you as a user registered. You can mention the present time. No need to worry.
user_status – set this to 0.
display_name – Insert the name you like to display.

MySQL Insert Metadata Fields

When you complete the fields then click OK button. Now again go to your_database and click the wp_metadata file. A new popup window will open as below in the picture. Arrow is marked on the concerned points for further action.

metadata After opening this file again click on the Insert tab, and you will see a new popup window with some empty fields.

metadata field values

At this point, you can see,

unmeta_id – No need to insert any value here it generates automatically.

user_id – 1204 we have given this id to the present user.

meta_key – this should be wp_capabilities

meta_value – insert this: a:1:{s:13:”administrator”;s:1:”1″;}

Insert another row with the following information:

unmeta_id – this is blank (it will generate automatically)

user_id – 1204 the same id

meta_key – this should be wp_user_level

and meta_value – 10

GoDaddy Backup

By this way, I have created the user name and id but still, I was facing the WordPress admin problem. It was not setting the admin login.  Now I went again to the WordPress normal admin panel. Click the “My Products” from my account page and click the “Backup” tab.

godaddy backup

In this option, you can see you can restore the files and database from the last 30 days. I have selected yesterday’s date that was 16-11-2019 (Nov 16, 2019) and started the backup process. Thanks for the different process ultimately, I was able to log in to my WordPress admin panel.

Conclusion:

From today’s activity, I have observed that today I was upset but not worried to take this situation because I have kept the latest backup of files and databases. I used it and recovered all the process.

0 0 votes
Give Your Rating
Subscribe
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Discover more from Apni Physics

Subscribe now to keep reading and get access to the full archive.

Continue reading