title: How to create new database in SQL Server Express 2008 and allow for connecting?
body: <p>I have a SQL Server Express 2008 R2 instance running on my local pc. </p>
  
  <ul>
  <li>Authentication is 'mixed' so I can login using a Windows login <strong>and</strong> using SQL Server authentication. </li>
  <li>Named pipes are enabled</li>
  <li>TCP/IP is enabled</li>
  <li>Remote connections are allowed</li>
  </ul>
  
  <p>I took the following steps to create a new login and database:</p>
  
  <ol>
  <li>I logged in using SQL Server Management Studio Express and created a new login</li>
  <li>I created a new database with the newly created login as owner</li>
  </ol>
  
  <p><img src="https://i.stack.imgur.com/M0oQ0.png" alt="New login"></p>
  
  <p><img src="https://i.stack.imgur.com/Ztsw1.png" alt="Login details"></p>
  
  <p><img src="https://i.stack.imgur.com/AsjiU.png" alt="New database"></p>
  
  <p><img src="https://i.stack.imgur.com/Kegg8.png" alt="Database security"></p>
  
  <p><img src="https://i.stack.imgur.com/kKovl.png" alt="Database owner overview"></p>
  
  <p>As you can see in the last screenshot there is a <strong>username</strong> "dbo" which 'belongs' to the <strong>login name</strong> "mylogin". I'm trying to use the following connection string but it doesn't work:</p>
  
  <blockquote>
    <p>Data Source=(local)\sqlexpress;Initial Catalog=newdb;User id=mylogin;Password=mypass</p>
  </blockquote>
  
  <p>The error log in SQL Server Management studio express states:</p>
  
  <blockquote>
    <p>Login failed for user 'mylogin'. Reason: Failed to open the explicitly specified database. [CLIENT: xxx.xxx.x.xx].
    Error: 18456, Severity: 14, State: 38</p>
  </blockquote>
  
  <p>If I change the <strong>User id</strong> in the connection string to "dbo" the following error is reported:</p>
  
  <blockquote>
    <p>Login failed for user 'dbo'. Reason: Could not find a login matching the name provided. [Client: xxx.xxx.x.xx].</p>
  </blockquote>
  
  <p><strong>I'm starting to turn really crazy now. I just have no idea on just how to get access to any database anymore... Is my SQL Server instance corrupt?</strong></p>
  
  <p><em>This problem only occurs when I try to connect from my ASP.NET applications. Connecting using SQL Server Management studio Express, using the credentials mentioned <strong>DOES</strong> work!</em></p>