devtrends.com
 

Changing the SA password in SQL Express 2005

Filed under: SQL, SharePoint — Tags: , — admin @ August 24, 2008 7:48 pm

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

Links

Microsoft has more information about the topic covered in this article at: http://support.microsoft.com/kb/322336

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=306429&SiteID=1

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Blog Categories
  • BlackBerry (1)
  • Group Policy (1)
  • Linux (1)
  • Microsoft Office (1)
  • Networking (1)
  • Printing (3)
  • SharePoint (6)
  • SQL (1)
  • Visual Studio (3)
  • Windows XP (1)

  •