Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create sql server database user correctly

I'm trying to create a user in a SQL Server database with SQL authentication. That's what I did:

  1. Created database named testDb (with default parameters)
  2. ran script

    CREATE LOGIN test 
        WITH PASSWORD = 'test';
    USE testDb;
    CREATE USER test FOR LOGIN test;
    GO 
    
  3. Ensured user test appeared in Databases\testDb\Security (in Management Studio)

  4. Tried to connect to the server with Management Studio using user test
  5. Got 18456 error.

I'm using SQL Server 2008 Developer Edition. The OS is Windows 7 Ultimate. What am I doing wrong?

like image 488
StuffHappens Avatar asked Oct 09 '11 07:10

StuffHappens


1 Answers

By default SQL Server logins are disabled.

You need to right click the instance in SSMS object Explorer then from the "Properties" dialogue, Security Tab enable "SQL Server and Windows Authentication mode".

This requires a restart of the SQL Server service to take effect,

like image 78
Martin Smith Avatar answered Oct 14 '22 05:10

Martin Smith