CREATE DATABASE permission denied in database 'master' (EF code-first)
I had the same problem. This what worked for me:
- Go to SQL Server Management Studio and run it as Administrator.
- Choose Security -> Then Logins
- Choose the usernames or whatever users that will access your database under the Logins and Double Click it.
- 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.
- 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:
Be sure you have permission to create db.(as user2012810 mentioned.)
or
It seems that your code first use another (or default) connection string. Have you set connection name on your context class?
public class YourContext : DbContext
{
public YourContext() : base("name=DefaultConnection")
{
}
public DbSet<aaaa> Aaaas { get; set; }
}