How to solve the problem that the create database permission is denied in the DATABASE 'master'

Source: Internet
Author: User

Copy codeThe Code is as follows:
Public partial class CMS_DBDataContext
{
Partial void OnCreated ()
{
// Create a database if the database does not exist
If (! This. DatabaseExists ())
{
This. CreateDatabase ();
}
}
}

The following error occurs: the create database permission is denied in the 'master' DATABASE.

After reading the relevant information, we know that to run the SQL Server database, you must create a database under the instance. Whether it is directly created, appended, or restored, you must create a database under the instance.

Therefore, modify the connection string,

<Add name = "SE_DBConnectionString" connectionString = "Data Source =. \ sqlexpress; Initial Catalog = SE_DB; Integrated Security = True; Pooling = False; User Instance = True "providerName =" System. data. sqlClient "/>

After adding User Instance = True, you can use the Instance to successfully create a database.

Solution 2:

Assign the database administrator role to the user who logs on to the database. This error can also be solved. For example, in ASP. NET, a network service user accesses the database and can set the database role of this user as the database administrator. In short, ensure that the login user has the right to create, modify or delete the database.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.