views:

62

answers:

4

I'm logging in to create a new database from CMD through sqlcmd with SA account. Its response is a message: CREATE DATABASE permission denied in database 'master'.

I'm using Windows server 2003 and SQL 2008. Please help me. Thanks in advance.

A: 

...Run As Administrator should do the trick.

George
A: 

Typically the user you're using to run the SQL Server service will not have access to certain folders, which is likely why you're getting this error.

Consider one of these alternatives:

  • change the credentials used for the service (ick!)
  • use runas /u:... or Run as...
  • add permission for the service to access those folders
  • move the database to a location that the service can access
John Feminella
A: 

I would check whether the user you are using indeed has CREATE DATABASE permission though. You can check what server roles it belongs to, because it seems it is not a sysadmin role.

You can use this query for example.

select suser_name(role_principal_id) [login ...], 
suser_name(member_principal_id) [... belongs to] 
from sys.server_role_members

Regards

Piotr

Piotr Rodak
+1  A: 

It doesn't sound like you're actually using the sa account, or else perhaps you haven't set up your service account properly using SQL config mgr. If you used Computer Manager | Services, then the service might not have permission to create the database files.

Rob Farley