织梦CMS - 轻松建站从此开始!

欧博ABG-会员注册-官网网址

欧博abghow to reset SQL Server sa password

时间:2025-09-04 01:22来源: 作者:admin 点击: 6 次
I had the same problem. Tried googling it and all the standard solutions didn't work so I had to get creative. Essentially my problem was that the SA

I had the same problem. Tried googling it and all the standard solutions didn't work so I had to get creative. Essentially my problem was that the SA account was disabled, also the system was set to only allow login by windows authentication, and finally the administrator account in windows also was not a member of the sysadmin role. So all the normal suggestions kept giving me permission denied errors (because I didn't have permissions to alter what other posts were telling me I should alter).

My solution is documented below, only apply the parts you need:

Stage 1: - Get SSMS working in single user mode

Open Sql server configuration manager (SSCM)

Click on SQL Server Services

Right click on SQL Server (MSSQLSERVER) and click properties

Click on the advanced tab

Find "Startup Parameters" and add the following

"-m;" at the beginning or ";-m" at the end (note the semi-colons but without quotes)

be careful to not add any white spaces as the parser is very picky

Press ok

Right click again and press restart

If you get any problems with the service not starting, verify step 5.

Stage 2: Part 1: - Enabling SQL Server and Windows Authentication mode

Start SSMS again.

This time when SSMS starts it will start in Single user mode which gives you full access.

Login with the usual windows account as before.

Right click on the server node (the very first / topmost node) and choose properties.

Click on Security

Under "Server authentication" click on "SQL Server and Windows Authentication mode" if its not already selected.

Click ok

Stage 2: Part 2: - Adding yourself into the sysadmin role

Click on "Security" and then "Server Roles"

Right click on "sysadmin" role

In the window that pops up, click add at the bottom.

In the window that pops up, click browse

Find your user and click the checkbox beside the name.

Click ok - this will return you to window in step 4 which will now have your user(s) in the lower box.

Click ok - this will return you to the window in step 3 which will add your user(s) to the role members list.

Click ok. - Congrats, you now have all the rights of the SA user.

Stage 2: Part 3: Altering the SA Password and enabling the account

Double Click on Security.

Double Click on Logins.

Right click on SA and choose properties.

Change and confirm the password fields (But don't press ok yet).

Click on the Status tab.

Click on Enabled.

Click ok

This is the process for resetting any users password (for a sysadmin). At this stage you should close SSMS.

Stage 3: Restarting SSMS in multi user mode.

Follow the steps taken in Stage 1 and simply remove the -m;

Stage 4: Trying on your bigger shoes.

At this stage you should be able to enable or disable the SA account from your login and change its password, also you should be able to enable or disable the ability to login with SQL Server authentication. Test these to ensure you have necessary rights.

Notes: Some taught should go into doing this. I feel that a sysadmin account should be the first thing setup once you setup a new SQL server instance.

Some people recommend removing the SA account (Personally, I recommend just putting a really strong password on it). As long as you have an account with sysadmin this is fine but someone must have an account with sysadmin access. This account should not be named Admin or some variant thereof like God for obvious reasons. Also avoid names such as your business name and combinations of either etc.

As regards to enabling or disabling sql server authentication that's a debate I'll leave for the DB admins.

Hope you find this helpful.

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-09-06 14:09 最后登录:2025-09-06 14:09
栏目列表
推荐内容