Changing connection authentication

  • maylar

    SSC Veteran

    Points: 243

    Using SQL Server 2014 Express, the initial install was set to use Windows Authentication. I'd like to change that to SQL Server Authentication with a user name and password.
    Is that possible, and if so how do I do that from within the Management Studio IDE?

    Also, I'm accessing the DB through a C# application. How would the connect string change once there's a user name / password set? Currently I have these values:


    LocalDatabaseName = computername + "\\SQLEXPRESS"; // where computername is  System.Windows.Forms.SystemInformation.ComputerName, and 
    string connstring = "Data Source=" + LocalDatabaseName + ";Initial Catalog = master;Integrated Security=True";

    Thanks.

  • Sue_H

    SSC Guru

    Points: 89874

    maylar - Tuesday, January 30, 2018 7:18 AM

    Using SQL Server 2014 Express, the initial install was set to use Windows Authentication. I'd like to change that to SQL Server Authentication with a user name and password.
    Is that possible, and if so how do I do that from within the Management Studio IDE?

    Also, I'm accessing the DB through a C# application. How would the connect string change once there's a user name / password set? Currently I have these values:


    LocalDatabaseName = computername + "\\SQLEXPRESS"; // where computername is  System.Windows.Forms.SystemInformation.ComputerName, and 
    string connstring = "Data Source=" + LocalDatabaseName + ";Initial Catalog = master;Integrated Security=True";

    Thanks.

    In SSMS, right click on the instance name, select properties. Then select the Security page. The authentication is the first section where you can set it to SQL Server and Windows authentication mode. 

    For the connection string, remove the Integrated Security=True and replace it with User ID=UserName;Password=UserNamePassword;

    Sue

  • maylar

    SSC Veteran

    Points: 243

    Just wanted to say thank you, Sue.
    Dave.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply