permission denied in database 'master'
See original GitHub issueHi,
On a shared MSSQLSERVER 2019, where public view any database is denied to all users, Entity Framework returns the following error:
<Message>An error has occurred.</Message>
<ExceptionMessage>CREATE DATABASE permission denied in database 'master'.</ExceptionMessage>
<ExceptionType>System.Data.SqlClient.SqlException</ExceptionType>
<StackTrace> at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at
If we give to the user “sysadmin” or “View any database”, the application works, without that, fails.
If we define wrong password, the system returns failed login.
Even with this error, using SMSS, we can login with user and password, database is not visible but if we query the MSSQL.
SELECT name FROM master.dbo.sysdatabases
1 master
2 tempdb
3 MYDATABASE
Based on this, user and password have access and can access to the MYDATABASE but for some reason without sysadmin or see “any database”, the Entity Framework returns that Exception.
Any suggestion to workaround this on a shared environment where user cannot be a sysadmin / dbcreator / etc?
Thank you
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
sql server - CREATE DATABASE permission denied in ...
Go to Database-> Security -> Logins section in object explorer and edit the properties of the user that you want to have create...
Read more >CREATE DATABASE permission denied in database 'master'
Permissions are granted when the login have the required roles. The role having permission to create, alter and drop database is dbCreator.
Read more >How to fix "CREATE DATABASE permission denied in ...
If you receive the following error message CREATE DATABASE permission denied in database 'master', check whether the user account has 'dbcreator' access.
Read more >What should I do if I receive this - create database permission ...
In case of - create database permission denied in database master - The user must be a member of the dbcreator server role...
Read more >CREATE DATABASE permission denied in ...
Open the Start menu, select All Programs, and open Microsoft SQL Server 2005/2008->Configuration Tools->SQL Server Surface Area Configuration.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information.
@tiagomreis This is EF6, not EF Core. Make sure to disable database initializers.