How to Change the 'sa' password in SQL Server 2005

If you happen to forget your SQL Server password for 'sa' account, then here's a simple query to help you reset it:

GO
ALTER LOGIN [sa] WITH DEFAULT_DATABASE=[master]
GO
USE [master]
GO
ALTER LOGIN [sa] WITH PASSWORD=N'MyNewPassword' MUST_CHANGE
GO


In Case you remember your Old Password and want to change the 'sa' password, use this query:


ALTER LOGIN [sa] WITH PASSWORD = N'MyNewPassword' OLD_PASSWORD = 'MyOldPassword';
GO


About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

2 comments:

windows password unlocker said...

A few days ago, I had a painful exprience that I lost sa password on my MS SQL Server database, and I almost took the whole weekend to look for some efficient SA password recovery solutions. I asked friends, searched on Internet and even bought some books... Fortunately, I finally got MS SQL Server Password Unlocker and it instantly changed the SA password but no data loss. Besides, I also got a couple of good "recover SA password" solutions in order to save your weekend in case you have lost or forgot MS SQL Server passwords (SA password!)

Brent said...

I also know a software which can also reset forgotten SA password, it's called SQL Server Password Changer, it's worth a try.