In the right panel, change the LoginMode from 1 to 2.Navigate to the registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer, where MSSQL10.SQLEXPRESS is the name of your SQL Server instance.Press the Windows key R to bring up the Run box.If you can connect to SQL Server with SQL Server Management Studio, you can easily switch to mixed mode with just a few mouse clicks! However, what to do if you’re locked out of every SQL Server account and can’t login even with Windows Authentication? Here is a simple registry trick: 0 '%sqllogin%' was successfully added to the 'sysadmin' role.) else '%sqllogin%' was NOT added to the 'sysadmin' role: SQL return code is %sqlresult%.Can’t login to SQL Server with Windows Authentication? Have you accidentally removed the built-in administrator account from sysadmin server roles? Does the Windows account become locked and unusable for further use? Don’t worry! In this article we’ll show you how to enable mixed mode authentication in case your SQL Server is configured for Windows Authentication only, and then enable / reset your SA password easily! Sc query '%sqlservice%' service is invalid :: start the SQL service for normal connections :: stop the SQL Stop the '%sqlservice%' service. įor /F "usebackq tokens=1,3" %%i in (`sqlcmd -S np:\\.\pipe\SQLLocal\%sqlinstance% -E -Q "create table #foo (bar int) declare int execute = sp_addsrvrolemember '$(sqllogin)', 'sysadmin' print 'RETURN_CODE : as char)"`) do if. :: access tempdb to avoid a misleading shutdown Add '%sqllogin%' to the 'sysadmin' role. :: add the specified user to the sysadmin role :: 4022 - do not start Start the '%sqlservice%' service in maintenance mode. :: 4010 - enable shared memory only (lpc:) :: start the SQL service with the '-m' option (single admin connection) and wait until its STATE is '4' (STARTED) :: determine if the SQL service is running STATE set srvstate=%%jĮcho new ActiveXObject("Shell.Application").ShellExecute("cmd.exe", "/D /Q /C pushd \"" WScript.Arguments(0) "\"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |