2

I have installed SQL Server 2008 R2, and was able to login and also create a database and everything.

When I was facing some problems with connecting my .NET project with SQL Server, I created some new accounts in SQL Server.

For some reason I uninstalled it. But later when I re-installed, I was not able to login with the "SA" account. I still see a few of the other user accounts that I created earlier.

Is there any way to completely uninstall SQL Server 2008 R2 and successfully install new copy and login?

1

2 Answers 2

1

Log in with your Windows account and enable the SA login again. You'll probably need to configure the SQL Server for mixed mode authentication as well.

If you decide that you do want to reinstall SQL, after uninstalling it you'll need to remove the database files then you can reinstall. SQL leaves the databases alone when you uninstall so that you don't loose any accounts or data when reinstalling.

2
  • @mrdenny.. Could you please let me know, how to remove database files also, when uninstalling SQL SERVER..To my knowledge... after uninstalling sql server, I have deleted all the related folders to Microsoft Sql server in Program files of C:\ drive correspondingly...Anything more to be done...Or how can I ensure that I have deleted all the database files to remove all the accounts or data.... Sep 10, 2012 at 5:18
  • The database files could be anywhere. Their location will depend on where you specified during the installation. By default this will be c:\program files\microsoft sql server\mssql.mssqlserver\mssql\data but could be just about anywhere. Search the computer for master.mdf. The files in that folder will be the ones you want to remove. I'd just move them to another folder instead of deleting them.
    – mrdenny
    Sep 11, 2012 at 3:52
1

First of all, one advice: better not use SA login name. Best practice is to disable the SA account. Many of your daily and routinely tasks on the sql server does not requier a high privileged account with sysadmin permissions. Create an account with the appropiate permissions and use it for daily work. Another advice on why to disable the sa account is because every attempt will try to probe the SA account.

--Query to disable the SA account.
ALTER LOGIN sa DISABLE;

Check this post for even more details on the subject.

In case you forgot the password, here and here you have a couple of helpfull posts by Pinal Dave on how to restore.

If you removed all the databases files from all related folders then you should not have any database remaining from previous install. But I do not see the need of removing previous databases.

You can change the server authentication mode by usign this code:

ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = 'your_password_here';
GO

More inforamtion here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.