"CREATE DATABASE permission refused in database'master'," says EF Code First.

c# ef-code-first entity-framework sql-server-2008

Question

I just want to quickly spin up the default database in my development environment.

How is the easiest way to get around this problem?

1
3
10/6/2011 9:46:28 AM

Popular Answer

I once faced this problem and resolved it. The key is using SQL authentication instead of Windows'. This is the clearest way to specify the default db.

Try connection string in this way:

<add name="MFCConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MFC.mdf;Initial Catalog=MFC;Integrated Security=false;User ID=sa;Password=123"
  providerName="System.Data.SqlClient" />

remember to set default db of sa from master to MFC, and Integrated security = false. BTW, sa is normally disabled, so enable and test it in sql server management studio first.

3
9/6/2013 2:49:01 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow