Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

code-first

I use code-first in my project and deploy on host but I get error

CREATE DATABASE permission denied in database 'master'.

This is my connection string:

<add name="DefaultConnection"       connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-test-2012615153521;Integrated Security=False"       providerName="System.Data.SqlClient;User ID=test;Password=test"/> 
like image 621
Mohammad Avatar asked Jun 27 '12 17:06

Mohammad


1 Answers

I had the same problem. This what worked for me:

  1. Go to SQL Server Management Studio and run it as Administrator.
  2. Choose Security -> Then Logins
  3. Choose the usernames or whatever users that will access your database under the Logins and Double Click it.
  4. Give them a Server Roles that will give them credentials to create database. On my case, public was already checked so I checked dbcreator and sysadmin.
  5. Run update-database again on Package Manager Console. Database should now successfully created.

Here is an image so that you can get the bigger picture, I blurred my credentials of course:enter image description here

like image 106
Willy David Jr Avatar answered Sep 21 '22 13:09

Willy David Jr