afr0
afr0

Reputation: 888

Entity Framework 7 code first error CREATE DATABASE permission denied in database 'master'

I'm using vs2015 an vNext/Asp.net5 wint EF7. my config.json file has following value

"TestContextConnection": "Server=.\\SQLEXPRESS;Database=TestDb;Trusted_Connection=true;MultipleActiveResultSets=true"

Whenever I run this project I get the following error

CREATE DATABASE permission denied in database 'master'.

Can someone please explain, I don't know what user I'm referring here is it my active directory user or some other dbuser? also what rights I've to assign to what user in order this code to work successfully? what if I have to create a new user from scratch with all required permissions for this?

Thanks in advance.

Upvotes: 0

Views: 224

Answers (2)

afr0
afr0

Reputation: 888

I figured out I was point to the wrong sql server instance on my machine. I corrected the server instance and my problem was resolved.

Upvotes: 0

Ryan Helmoski
Ryan Helmoski

Reputation: 369

Do you need to use the TestDb database on the SQLEXPRESS server, or are you just trying to get something up and running?

If you are just trying to get something up and running, try using the following for your connection string: Server=(localdb)\\MSSQLLocalDB;Database=<DATABASE_NAME>;Trusted_Connection=True;MultipleActiveResultSets=true

Upvotes: 1

Related Questions