Richard77
Richard77

Reputation: 21621

Can't access the SQL Server engine even from Management Studio

I just installed SQL Server 2012 Express edition on my computer (Windows 8).

When I try to create a database from the Management studio, I'm getting the following error:

Create failed for Database 'TestDB'. (Microsoft.SqlServer.Smo)
CREATE DATABASE permission denied in database 'master'.
(Microsoft SQL Server, Error: 262)

When I try to access it from the visual studio, I'm getting the following similar error message:

CREATE DATABASE permission denied in database 'master'.

Is there any reason for that? I can't even access the engine from the management studio.

EDIT

Here's my connection string

<add name="DefaultConnection" 
     connectionString="Data Source=localhost\sqlexpress;Initial   
        Catalog=OptimumWeightDB;Integrated Security=True;
        Integrated Security=True;
        User Id=sa;Password=mypassword" " 
     providerName="System.Data.SqlClient" />

This is the context class

public class OWDbContext : DbContext
{
    public OWDbContext()
        : base("DefaultConnection") { }
}

Upvotes: 0

Views: 1832

Answers (1)

BizApps
BizApps

Reputation: 6130

First of all. Try to log into SQL Management Studio on your SQL Server using Windows Authentication.

If you can create database / manipulate database using you windows account there maybe a problem on the security set up on your sa login account.

Then try to re create / create new login account and set its permission to db admin.

Other thing make sure that SQL server Authentication is Enabled on your SQL Server.

When you already connected to your SQL Server using Windows Authentication right click your SQL Server > Properties > Security > SQL server and Windows Authentication mode.

also change your connection string to

Data Source=localhost\sqlexpress; Initial Catalog=OptimumWeightDB; user=yourloginname; password=yourpassword;

Best Regards

Upvotes: 1

Related Questions