How to change the SQL sa password from a command prompt


To change the SQL sa password from a command prompt:

Start a command prompt by typing StartRuncmd

Enter the following commands, pressing Enter after each line

OSQL -S yourservername -E
    1> EXEC sp_password NULL, ‘yourpassword’, ‘sa’
    2> GO

Where yourservername is the name of your server and yourpassword is the new sa account password.  Type exit twice to return to the server desktop. 

This works in SQL 2005, I don’t have access to other versions so I can’t say if it will or won’t work other versions of SQL.

Posted in howto. Tags: , , , . 4 Comments »

4 Responses to “How to change the SQL sa password from a command prompt”

  1. Ertugrul Tame Kara Says:

    Thanks for great advice!

  2. Matthew1Clarke Says:

    Nice one.
    Many thanks.
    Matt

  3. fiona Says:

    http://tweakpdf.blog124.fc2.com/blog-entry-19.html
    there is a post from where you can get to know how to change the SQL sa password from a command prompt.
    Personally, I would like to take use of the third part password recovery tool like MS SQL Server password Unlocker, which helps to reset the sa and other account passwords instantly.

  4. fiona Says:

    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!)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: