Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot enable sa account

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?

like image 966
asp.net programmer Avatar asked Aug 01 '13 10:08

asp.net programmer


People also ask

Why is SA disabled?

Ever noticed and wondered why the well-known SQL Server system administrator (sa) login is in a disabled state? The reason is simple, sa login account is disabled out of the box (by default) in Windows Authentication mode. You have to enable manually to use it.

Is SA account disabled by default?

It is disabled by default. You should see a down arrow next to it. 3. Right click on the SA account and go to properties.

Why is it not advisable to enable the SA account in SQL Server?

Because the sa account is well known and often targeted by malicious users, do not enable the sa account unless your application requires it.


1 Answers

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

like image 188
Darren Avatar answered Sep 21 '22 04:09

Darren