Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Wednesday, September 24, 2008

SQL Server 2005 Express: Lost the sa password

Today's development requires most people to be able to connect to multiple SQL database. Changing database environment might become a hassle. Today I have to setup a new database environment running on SQLServer Express (a local development database) , while I already have another database running. Previously I already set the database to use Mixed Mode which means I could login through Windows Authentication (the default setting a more sophisticated and manageable approach) and through the old school username and password.
For development environment in your local machine, the old school approach seems to be more reasonable. You could have your environment setup in a script, wipe it out and recreate it again without disturbing the ActiveDirectory users etc.

Because I have not been using the sa (default administrator) user for long I have forgotten it. I search the Internet and find a way to recover the password.

C:\> osql -E -S .\SQLEXPRESS
1> exec sp_password @new='nupasswd', @loginame='sa'

2> go

3> exit

C:\>

Now try to login using the username 'sa' and the 'nupasswd'.