Powered by Blogger.

Saturday, February 15, 2014

Change authentication mode after installation of SQL Server

In this post we will discuss how to change authentication mode after installation of SQL Server 2008. Also you can check my previous posts on:

- Passport authentication in Asp.Net

- ExecuteNonQuery(), ExecuteReader() and ExecuteScalar() in Ado.Net

- Caching in Asp.Net

During installation, SQL Server database engine is set to either Windows Authentication mode  or SQL Server and Windows Authentication mode.

If Windows Authentication mode is selected during installation, the sa login remains disable.

If you later change authentication mode to SQL Server and Windows Authentication mode, the sa login remains disabled. To enable the sa login, use the Alter Login statement.

The sa login can only connect to the server by using SQL Server Authentication.

To Change security authentication mode:

In SQL Server Management studio Object Explorer, right click on the server, and then click Properties.

On the Security page, under the Server authentication, select the new server authentication mode, in the SQL Server Management studio dialog box, click ok to acknowledge the requirement to restart the  SQL Server.

To restart SQL Server from SQL Server Management studio:
In object explorer, right-click on your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.

To Enable the sa login by using Transact-SQL:
Execute the statements to enable the sa password and assign a password.
Alter LOGIN sa Enable;
Alter Login sa WITH PASSWORD = '<enterstrongpassword>';

To Enable the sa loginby using Management Studio:
In Object Explorer, expand Security,expand Logins,right click sa, and then click Properties.

on the General page , you might have to create and confirm a password for the sa Login.

On the Status page, in the Login section, click Enabled, and then click ok.