Search code examples
sql-serversql-server-2014

How to recreate SQL Server MSSQLServer windows user for a SQL Server 2014 SP1 installation


I had a new machine which windows crashed and I had to do a Windows reset which reinstalled Windows. Afterwards I deleted the old app user accounts in the C:\Users folder since the reinstall didn't delete it, these included SQL Server MSSQLServer and .net accounts because I was going to install all the apps from scratch I decided to clear it up and delete it.

I then ran SQL Server 2014 SP1 setup selecting database engine, client connectivity and Management Studio on default instance MSSQLServer using mixed mode authentication and added my own sa password and my current windows user.

At the end of my installation I notice the installer takes a very long time at the following step

SqlEngineDBStartConfigAction_install_configrc_Cpu64

I then get an error

The following error occurred:
Could not find the Database Engine startup handle.

Logs

Feature: Database Engine Services Status: Failed: see logs for details Reason for failure: An error occurred during the setup process of the feature. Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again. Component name: SQL Server Database Engine Services Instance Features Component error code: 0x851A0019 Error description: Could not find the Database Engine startup handle. Error help link: http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.4100.1&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4025

I open SQL Server configuration manager Services and noticed my MSSQLServer doesn't start up because it runs as NT Service\MSSQLSERVER user. I change that to local system account and start the service and the service runs.

However when I open SQL Server Management Studio and try to connect to the database engine I can't connect with neither my windows user I added during the SQL Server setup nor the sa user with password I specified.

Cannot connect to PCName. Login failed for user PCName\User. Microsoft SQL Server Error 18456

When I uninstall SQL Server and reinstall it I get the same issue. Even when I delete the program files directory C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER

  1. How do I get it to work?

  2. Why does a new SQL Server 2014 SP1 installation not create the MSSQLServer user?

  3. How to I create the MSSQLServer user manually and what permissions and groups do I assign to it?


Solution

  • I tried everything to resolve it. Delete all the SQL Server folders. Remove registry entries as mentioned in other stackoverlow answers. Installed SQL Server 2014 SP1 again and the problem still occurs.

    Even when I installed SQL Server 2012 SP1 on the default instance I would still get the error.

    The only workaround I could get it to work was to install SQL Server as a separate instance and not the default instance.

    This made me thinking if the issue is only related to the default instance.

    I looked at my C:\Users folder and the default instance MSSQL user folder was not there meaning the installer never created it. The problem must have occurred that I previously deleted the User folder to clean up the machine where I should have deleted the windows users from Control Panel Admin Tools instead.

    Solution: Use regedit.exe

    The problem entry should be the corresponding S Folder in.

    HKEY_LOCAL_MACHINE - SOFTWARE - Microsoft -Windows NT -CurrentVersion -ProfileList

    Delete this user

    Reinstall and verify in the C:\Users if the MSSQL user gets created.

    I tried to be safe and deleted all references to the MSSQL user in the registry user after uninstalling all SQL Server references in Add/Remove Programs and clearing up the Program Files folders the one registry item is probably the cause.