find and solve || findandsolve.com
Please wait.....

CREATE DATABASE permission denied in database master

CREATE DATABASE permission denied in database master

When I am creating a new database in SQL server and it shows an error that "CREATE DATABASE permission denied in database 'master'" I am using the administrator log in itself. What do I need to do?

create database Account

When I have executed the code this type of issue has occurred.

CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262)

Answer


Option 1.

  •  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 Server Roles that will give them credentials to create a database. In my case, the public was already checked so I checked dbcreator and sysadmin.
  • Run update-database again on Package Manager Console. The database should now be successfully created.


Option 2.

  1. Disconnect from your local account.
  2. Again Connect to Server with Login: sa and Password: PWD(PWD given to your local login).
  3. Object Explorer -> Security -> Logins -> Right click on your server name -> Properties -> Server Roles -> sysadmin -> OK
  4. Disconnect and connect to your local login and create a database.


Option 3.

To add a Windows user that has the login “machinename\Administrator” to the sysadmin fixed server role

  1. Log on to the computer using the credentials for the machinename\Administrator account.
  2. Click the Start button, point to All Programs, click Microsoft SQL Server, and then click SQL Server Management Studio.
  3. Connect to an instance of SQL Server.
  4. Click Security, right-click Logins, and then click New Login.
  5. In the Login name box, enter the user name.
  6. In the Select a page pane, click Server Roles, select the sysadmin check box, and then click OK.


Option 4.

Click on Start -> Click in Microsoft SQL Server Now right click on SQL Server Management Studio Click on Run as administrator

Mahira  khanna

Mahira khanna

I have the skills you need for you company blog, website, or other content materials

If findandsolve.com felt valuable to you, feel free to share it.

Comments



Report Response