Sunday , August 18 2019
Home - Don't Forget! - Changing the SA password in SQL Express 2005

Changing the SA password in SQL Express 2005

Sometimes when you install SQL Express 2005 as a component of another product, that application installation will configure the environment, effectively restricting your access to the SQL database. This is primarily due to the application setting the SA password and not telling you what it is.

With SQL Express 2005, the new command line is sqlcmd, which supposedly replaces osql.

Resetting the SA password

If you need access to the database, you can reset the SA password using the following commands from a command prompt (cmd):

sqlcmd –S SQLSERVER\INSTANCE

Once in the interface for sqlcmd, which is represented by a 1>, type the following on separate lines:

  • sp_password @new = ’newpassword’, @loginame = ‘sa’
  • go
  • exit

Just so you know, the @loginame procedure does have only one “n”.

Unlocking the SA user

If you have tried to access the database too many times with the wrong password, the SA account may be locked out. Do the following to unlock the account from a command prompt (cmd):

sqlcmd –S SQLSERVER\INSTANCE

Once in the interface for sqlcmd, which is represented by a 1>, type the following on separate lines:

  • ALTER LOGIN sa WITH PASSWORD = ‘newpassword’ UNLOCK
  • go
  • exit

Test It

You can test the user account, SA, by trying to connect with the SA account from whatever program you are using, installing, et cetera, or you can use OSQL to attempt a connection. From a command prompt (cmd), type the following:

osql –U sa –S SQLSERVER\INSTANCE

Enter your password

At the 1> prompt, type exit

Check Also

How to use DNS Pin Point instead Split Horizon – the easy way!

Background on the DNS issue faced There are times when DNS split horizon is required …

Leave a Reply

Your email address will not be published. Required fields are marked *