In past, some nopCommercer users have accidentally removed administrator role from the main admin account and lost the access to administration section. If you are not a programmers or database admin, it can be quite difficult for you to get back the access to the administrator section without anybody's help.
Today, we will go over the process of assigning administration role to any user via SQL script.
1) Simply go to your public store and create a new account that you would like to use as an admin
2) Now, connect to the SQL database (of your nopCommerce website)
3) Open the database in SQL Server Management Studio
4) Open the [Customer] table and get the customer ID of the account that you would like to use ad admin like this:
In this case, ID = 24
5) Now, open the query build and run this SQL command to add a new entry for mapping administrator role with your customer ID in table [Customer_CustomerRole_Mapping] like this:
INSERT INTO [dbo].[Customer_CustomerRole_Mapping]
([Customer_Id]
,[CustomerRole_Id])
VALUES
(24,1)
Note: Change the "24" with the your customer ID
6) Now, if we check the table [Customer_CustomerRole_Mapping], we should see our entry
Here is the IDs for all system roles:
Now, you should be able to login to administration section and going into the user account, the "Administrator" role should be checked automatically.