문제

I dont have users in sysadmin except [sa] user

unfortunately, I logged in as [sa] user and disabled it

then I cant enable it, what I can do to enable it again?

도움이 되었습니까?

해결책

You'll have to use sqlcmd.exe with Windows Authentication (Specify the -E flag) and renable the account:

Open up command prompt and navigate to the SQL Directory and use sqlcmd.exe -S server -E

USE [YourDatabase]
GO

ALTER LOGIN [sa] ENABLE
GO

http://msdn.microsoft.com/en-us/library/ms162773.aspx

다른 팁

login with windows authentication and select server properties and go to security tab check the bubble SQL server and windows authentication click ok.

or

run below query

ALTER LOGIN [sa] WITH PASSWORD='AnyStronG@#Passw)e', CHECK_POLICY=OFF
GO
ALTER LOGIN [sa] ENABLE
GO

Ref:- Enable Sa Login

  1. Launch SQL Server Configuration Manager (as local machine Administrator)
  2. Select SQL Server Services -> SQL Server Service on the right side
  3. Right-Click on it -> Properties -> Advanced Tab
  4. Into "Startup Parameters" string add ';-m' to the end of string -> This will bring SQL server to 'single user mode' in which local machine Admins have super-user rights.
  5. Restart service in order Startup Parameters to take effect.
  6. Login via SQL Server Management Studio using Windows Authentication as local machine Administrator -> now it has super-user preferences and allows you to change everything.

Check if both Windows and mixed authentication is enabled on the server properties > Security

.enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top