CREATE DATABASE permission denied in database ‘master’ (EF code-first)

Permission denied is a security so you need to add a “User” permission..

  1. Right click you database(which is .mdf file) and then properties
  2. Go to security tab
  3. Click Continue button
  4. Click Add button
  5. Click Advance button
  6. Another window will show, then you click the “Find Now” button on the right side.
  7. On the fields below, go to the bottom most and click the “Users”. Click OK.
  8. Click the permission “Users” that you have been created, then Check the full control checkbox.

There you go. You have now permission to your database.

Note: The connection-string in the above questions is using SQL-server authentication. So, Before taking the above step, You have to login using windows-authentication first, and then you have to give permission to the user who is using sql-server authentication. Permission like “dbcreator”.

if you login with SQL server authentication and trying to give permission to the user you logged in. it shows, permission denied error.

Leave a Comment