How to recover your administrator account if deleted by mistake in nopCommerce

So, you install a fresh copy of nopCommerce, enjoying all the feature and excited about setting up the store but suddenly you realize that while playing around with different options, you have deleted the administrator account by mistake.

How to recover your administrator account now?




No need to panic, as long as you have the access to your nopCommerce database, you can recover the deleted account.

Simply follow these steps:

1) Login to the database inSQL Server (using tool like SSMS etc)

2) Open the database and run this sql query:

UPDATE Customer
  SETDeleted = 0
  WHERE Id = 1


Notes:
(a) Id is the account id from the "Customer" table of your admin account. Usually id=1 for default admin account. If you create any extra admin account and trying to recover the account, then you will need to check the "Customer" table to get the correct id for the specific account (or record).

(b) All the account records if deleted, never gets permanently deleted from the database. Only the value of column "Delete" change from "False" to "True" if you delete any account. In  the sql script, we are simply changing the value back from "True" to "False".

3) How to recover the account if you do not have the "id"?

Well, as long as you remember the username or email address, you can change your sql script accordingly like this:

WHERE Username = 'MyUsername'


Or

WHERE Email = 'adminemail@store.com'


Hope it helps :)

About Author

Written By Lavish Kumar

Based out of New York, USA, Lavish Kumar is a full stack web developer by profession and founder of Striving Programmers, a trusted community for developers that offers a wealth of articles and forums to assist individuals with improving their software development skills.

Leave your comment