0

By mistake I have deleted the Admin user from Sitecore(9) User Manger panel and now unable to login with default user id and password i.e admin/b.

I have run the below query but no record found in core DB

SELECT UserId FROM [aspnet_Users] WHERE UserName = 'sitecore\Admin'
2

Insert a new user, sitecore\Admin. Then follow the instructions on this question to set the proper password.

For Sitecore 9, you need @Derek Dysart's answer.

SQL for inserting into the Membership database would look something like this:

declare @now datetime
set @now= GETDATE()
exec aspnet_Membership_CreateUser 'sitecore','sitecore\Admin','pass@word1', '','admin1@contoso.com','','',1,@now,@now,0,0,null

Source: https://stackoverflow.com/a/19258123/81631

I believe you will still need to update the password and salt as described in the referenced post.

Alternatively, these are the values in a default installation. From the dbo.aspnet_Membership table.

ApplicationId   UserId  Password    PasswordFormat  PasswordSalt    MobilePIN   Email   LoweredEmail    PasswordQuestion    PasswordAnswer  IsApproved  IsLockedOut CreateDate  LastLoginDate   LastPasswordChangedDate LastLockoutDate FailedPasswordAttemptCount  FailedPasswordAttemptWindowStart    FailedPasswordAnswerAttemptCount    FailedPasswordAnswerAttemptWindowStart  Comment
DD20E696-45B0-4074-B50E-F34B47F1E454    68FFFAA2-1FFE-4006-B661-A8B6B80C81DE    Tm9jY7uSHNQnx08P70kiVEBO2YM=    1   n4n5/iUJKDrabOzQyLOU8Q==    NULL            NULL    NULL    1   0   2017-12-19 15:40:30.000 2018-07-10 16:05:48.587 2017-12-19 15:40:30.000 1754-01-01 00:00:00.000 0   1754-01-01 00:00:00.000 0   1754-01-01 00:00:00.000 Sitecore Administrator
1

Thanks @Mark Cassidy , We need to add one more row in db table "[aspnet_Profile]"

Steps to create admin user via SQL queries in Sitecore 9:-

declare @now datetime
set @now= GETDATE()
exec aspnet_Membership_CreateUser 'sitecore','sitecore\Admin','pass@word1', '','admin1@contoso.com','','',1,@now,@now,0,0,null

UPDATE 
    [aspnet_Membership] 
SET 
    [Password]='qOvF8m8F2IcWMvfOBjJYHmfLABc=', 
    [PasswordSalt]='OM5gu45RQuJ76itRvkSPFw==', 
    [IsApproved] = '1', 
    [IsLockedOut] = '0'
WHERE 
    UserId IN (
        SELECT UserId FROM dbo.aspnet_Users WHERE UserName = 'sitecore\Admin'
    ) 


INSERT [dbo].[aspnet_Profile] ([UserId], [PropertyNames], [PropertyValuesString], [PropertyValuesBinary], [LastUpdatedDate])
 VALUES (Copy and Paste User ID from aspnet_Users DB table for sitecore\Admin,
  N'IsAdministrator:S:0:4:Portrait:S:4:27:FullName:S:31:13:ProfileItemId:S:44:38:SerializedData:B:0:3875:', 
  N'TruePeople/16x16/Astrologer.pngAdministrator{AE4C4969-5B7E-4B4E-9042-B2D8701CE214}', 
  0x0001000000FFFFFFFF01000000000000000401000000E20153797374656D2E436F6C6C656374696F6E732E47656E657269632E44696374696F6E61727960325B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D2C5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D040000000756657273696F6E08436F6D7061726572084861736853697A650D4B657956616C756550616972730003000308920153797374656D2E436F6C6C656374696F6E732E47656E657269632E47656E65726963457175616C697479436F6D706172657260315B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D08E60153797374656D2E436F6C6C656374696F6E732E47656E657269632E4B657956616C75655061697260325B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D2C5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D5B5DCE00000009020000002500000009030000000402000000920153797374656D2E436F6C6C656374696F6E732E47656E657269632E47656E65726963457175616C697479436F6D706172657260315B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D00000000070300000000010000001500000003E40153797374656D2E436F6C6C656374696F6E732E47656E657269632E4B657956616C75655061697260325B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D2C5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D04FCFFFFFFE40153797374656D2E436F6C6C656374696F6E732E47656E657269632E4B657956616C75655061697260325B5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D2C5B53797374656D2E537472696E672C206D73636F726C69622C2056657273696F6E3D342E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038395D5D02000000036B65790576616C7565010106050000000957616C6C70617065720606000000312F73697465636F72652F7368656C6C2F7468656D65732F6261636B67726F756E64732F6C69676874686F7573652E6A706701F9FFFFFFFCFFFFFF06080000001357616C6C70617065724261636B67726F756E640609000000072330373333374301F6FFFFFFFCFFFFFF060B0000001157616C6C7061706572506F736974696F6E060C0000000643656E74657201F3FFFFFFFCFFFFFF060E0000001464696765737463726564656E7469616C68617368060F00000020373130373464333335653834393632396562616532383434656165333436306101F0FFFFFFFCFFFFFF06110000002164696765737463726564656E7469616C68617368776974686F7574646F6D61696E061200000020313961323764323333663534633962303930303764303533326634666464343301EDFFFFFFFCFFFFFF06140000001F2F73697465636F72655C61646D696E2F526962626F6E2F4D792053747269700615000000267B44333341303634312D394631432D343938342D383334322D3036353543334430463132337D01EAFFFFFFFCFFFFFF06170000000D5061636B616765722F46696C6506180000002F536D61727420546F6F6C7320204164642056657273696F6E20616E6420436F707920436F6E74656E7431302E7A697001E7FFFFFFFCFFFFFF061A000000372F73697465636F72655C61646D696E2F557365724F7074696F6E732E436F6E74656E74456469746F722E56697369626C65537472697073061B000000AC037B43334643454242392D463338462D344142342D383537462D4346433431354236413334327D7C7B44304643393944392D354336352D343341332D414342362D3434393544343446423045377D7C7B39324144453739322D363833462D343830442D413330412D3031433146314241414235337D7C7B46353142433531412D463541462D343144462D414431312D4630443142343846464339337D7C7B36353533363336462D453930342D344632442D423232322D3039304430413236323938437D7C7B34434636343731362D384238432D344142432D383643322D4639433546334646313132387D7C7B44363030433133392D393244372D343844452D424239462D3438313241334442394138427D7C7B34383936374331392D433338372D343534442D384544322D3536324446313430394430387D7C7B41454439354537452D383734412D344346302D393234422D3844443930464338443733307D7C7B33333645393943382D433435462D344342372D393133362D4339463846453830324538467D7C7B42423246424235352D454243382D343732342D394131462D3337424346454430333730447D01E4FFFFFFFCFFFFFF061D000000312F73697465636F72655C61646D696E2F436F6E74656E7420456469746F722F53656374696F6E732F436F6C6C6170736564061E0000000B517569636B496E666F3D3001E1FFFFFFFCFFFFFF0620000000232F73697465636F72655C61646D696E2F4D656469612F55706C6F616465644974656D730621000000E0043230313430323039543231303432342373697465636F72653A2F2F6D61737465722F7B44363441363142352D463836332D343634432D423534352D3045434639423637373141437D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B35413631433446392D363730322D343143352D424245422D3131393439453243453345467D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B31413033373138442D364338462D343732322D424332352D3635464539424245353839367D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B39464445464539452D343742332D343532392D394333332D3431394230333239314430467D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B38374530313239352D363545342D343943372D383939442D3544304441433744434534387D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B34393134424644442D303830392D344635302D413235332D3545423030353232454544337D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B42373138433944302D383636332D343746342D424635392D3245434443354633353038317D3F6C616E673D64652D4445267665723D317C73697465636F72653A2F2F6D61737465722F7B42443643364230462D304333382D344433432D393131322D3141444535443537434536347D3F6C616E673D64652D4445267665723D317C01DEFFFFFFFCFFFFFF0623000000212F73697465636F72655C61646D696E2F5075626C6973682F4C616E677561676573062400000002656E01DBFFFFFFFCFFFFFF06260000001F2F73697465636F72655C61646D696E2F5075626C6973682F546172676574730627000000267B38453038303632362D444443332D344546342D413144312D4630424534413230303235347D01D8FFFFFFFCFFFFFF06290000002A2F73697465636F72655C61646D696E2F5075626C6973682F496E6372656D656E74616C5075626C697368062A0000000566616C736501D5FFFFFFFCFFFFFF062C000000242F73697465636F72655C61646D696E2F5075626C6973682F536D6172745075626C697368092A00000001D2FFFFFFFCFFFFFF062F000000212F73697465636F72655C61646D696E2F5075626C6973682F52657075626C6973680630000000047472756501CFFFFFFFFCFFFFFF0632000000272F73697465636F72655C61646D696E2F5075626C6973682F5075626C6973684368696C6472656E093000000001CCFFFFFFFCFFFFFF0635000000282F73697465636F72655C61646D696E2F436F6E74656E7420456469746F722F4C616E67756167657306360000000B65742D45457C656E2D474201C9FFFFFFFCFFFFFF0638000000222F73697465636F72655C61646D696E2F4C69737476696577732F4974656D4C69737406390000000744657461696C7301C6FFFFFFFCFFFFFF063B0000001F2F73697465636F72655C61646D696E732F526563656E74557365724C697374063C0000001173697465636F72655C546573745573657201C3FFFFFFFCFFFFFF063E000000292F73697465636F72655C61646D696E2F486973746F72792F4164642E46726F6D2E54656D706C617465063F000000267B42463242384441322D334342412D343835442D384638352D3337383842384146424442467D01C0FFFFFFFCFFFFFF0641000000202F73697465636F72655C61646D696E2F486973746F72792F54656D706C6174650642000000267B42463242384441322D334342412D343835442D384638352D3337383842384146424442467D0B, CAST(0x0000A2F500D2B376 AS DateTime))

Ref Link :-

  1. Follow First answer given by @Mark Cassidy for Sitecore 9, use insert query
  2. https://sitecore.stackexchange.com/a/6021/1338 , use update query
  3. https://egeek.io/sitecore-reset-sitecore-admin-password/ , use insert query for aspnet_Profile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.