I’m opening the SQL Server Management Studio with run as administrator…
And there is no problem with Windows Authentication Connection.
I’m choosing «New Database» by right-click the Databases folder.
And giving name ‘BTS’ for the Database.
When i’m choosing OK, i get the error as,
How to fix it?
asked Jun 13, 2014 at 5:42
From this blog post
To add a Windows user that has the login “machinenameAdministrator”
to the sysadmin fixed server role
- Log on to the computer using the credentials for the
machinenameAdministrator account.- Click the Start button, point to All Programs, click Microsoft SQL
Server, and then click SQL Server Management Studio.- Connect to an instance of SQL Server.
- Click Security, right-click Logins, and then click New Login.
- In the Login name box, enter the user name.
- In the Select a page pane, click Server Roles, select the sysadmin
check box, and then click OK.To add a Windows user that has the login “domainname username” to the
sysadmin fixed server role
- Log on to the computer using the credentials for the
domainnameusername account.Click the Start button, point to All Programs, click Microsoft SQL
Server, right-click SQL Server Management Studio, and then click Run
as administrator.ps: “Run As Administrator” option elevates the user permissions In
the User Access Control dialog box, click Continue.- In SQL Server Management Studio, connect to an instance of SQL
Server.- Click Security, right-click Logins, and then click New Login.
- In the Login name box, enter the user name.
- In the Select a page pane, click Server Roles, select the sysadmin
check box, and then click OK.
bob esponja
4,0833 gold badges31 silver badges29 bronze badges
answered Jun 13, 2014 at 5:52
Vignesh Kumar AVignesh Kumar A
27.7k13 gold badges62 silver badges114 bronze badges
Click Start —> All Programs —> SQL Server Management Studio Express
SQL Server Management Studio Express—> Right Click—>Run as Administrator—> Click Yes
It works
answered Nov 21, 2014 at 4:56
0
you are probably running more than one user profile on your laptop. While opening the program, right click and run as administrator
answered Jan 18, 2022 at 1:53
try this:
SqlSever>>Security>>Logins>>BUILTINUsers rightClick —>Properties
—>Server Roles
…select sysadimn
answered Apr 5, 2022 at 7:24
1
MS SQL users sometimes run into “SQL Error 262” while creating a new database, logging into SQL Server Management Studio, etc.
Here at Bobcares, we routinely see & resolve MS SQL errors such as this as part of our MS SQL Support services.
Today we will go through the top causes for this error, and how to fix it.
SQL error 262 occurs when..
- Trying to create new database in SQL Server Management Studio.
- Logging on SQL Server Management Studio.
- User tries to check the execution plan.
- Trying to connect to local SQL Server Express instance using a third party application.
Now, lets see how to fix it.
Fixes for MS SQL Error 262
Some of the possible fixes for MS SQL error 262 are:
- Grant Database Access to a single user.
- Resolve issue in SQL Express.
- Add Windows user to sysadmin role.
Now let’s see how to implement these fixes.
Grant Database Access to a single user
One of the scenarios where this SQL 262 error appears is when the user tries to check the execution plan using CTRL + M.
An execution plan is used to check how query will behave without having to execute it.
So, for including the execution plan in the query, we can allow SHOWPLAN access to the user.
Allowing particular user to grant the SHOWPLAN access using the commands shown helps in fixing SQL error 262.
USE DatabaseName
GO
GRANT SHOWPLAN TO UserName
GO
This helps fixing the error.
Fixing issue with SQL Server Express
We may encounter the 262 error while trying to connect to a local SQL Server Express Instance from a third party application.
We can fix this error using the steps shown:
- Firstly, follow the path:- Start> All Programs > Microsoft SQL Server> Configuration Tools >SQL Server Surface area Configuration
- Then, click on Add New Administrator
- Next, move to Member of SQL Server SysAdmin role on SQLEXPRESS and Add it to right-box.
- Finally, click on OK
Add Windows user to sysadmin role.
One of the reasons behind this 262 error to appear is not having an account available on SQL Server with sysadmin role.
There are two ways to add Windows user to the sysadmin fixed server role:
To add Windows user with login “machinenameAdministrator”
- Using the credentials for the machinenameAdministrator account log on to the computer.
- Then, click Start and follow the path:- All Programs > Microsoft SQL Server >SQL Server Management Studio
- Next, connect to an instance of SQL Server.
- Now, follow the path:- Security>right-click Logins>New Login.
- Enter the user name In the Login name box,
- Finally, in the Select a page>Server Roles
- Finally, select sysadmin check box and then click OK.
To add Windows user with login “domainname username”
- Using the credentials for the domainnameusername account log on to the computer .
- Next, follow the path:- Start> All Programs > Microsoft SQL Server >SQL Server Management Studio.
Note: “Run As Administrator” option elevates the user permissions In the User Access Control dialog box, click Continue. - Then, connect to an instance of SQL Server in SQL Server Management Studio .
- Next, follow the path >> Security>>right-click Logins>>click New Login.
- Enter the user name in the Login name box,.
- Finally, Go to Select a page, click Server Roles, select the sysadmin check box, and then click OK.
[Need assistance in fixing MS SQL errors? We are available 24×7.]
Conclusion
In short, MS SQL error 262 may occur in different scenarios like creating new database in SQL Server Management Studio, connecting to local SQL Server Express Instance from a third party application, etc. Today, we discussed in detail the possible ways by which we can handle such scenarios to fix this error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
- Remove From My Forums
-
Question
-
Hi
I have migrated to a new computer using Windows 7, 6 gig memory, I7 chip (old machine had xp) and have installed Visual Studio 2008 and SQL Server 2008 R2.
I get CREATE DATABASE permission denied in database ‘master’. (Microsoft SQL Server, Error: 262) when I try to create a new database.
Other posts (example:http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/28fee0ed-c7e2-40df-8f79-f513c9848f09/) work for Vista but I cannot find how to grant permissions. Run as administrator (vista fix) does not work.
I have admin privaleges on my machine. There are no other accounts.
What do I need to do to update privaleges?
Thanks and have a nice day.
Answers
-
Click Start —> All Programs —> SQL Server Management Studio Express
(Right Click —> Run as administrator)
Then Click «Yes» in Dialog box
Now you can Create the Database…
It really works..
-
Proposed as answer by
Thursday, February 24, 2011 4:37 PM
-
Marked as answer by
Ed Price — MSFTMicrosoft employee
Saturday, November 17, 2012 5:02 AM
-
Proposed as answer by
-
During the setup of SQL 2008 you must have specified (at least one) system administrator for the instance of SQL Server, or SA account if you are using mixed mode authentication
you need to use credentials for that account to gain access to your SQL Server,
The last option is to start SQL server in a singler user mode, in that case anyone who is local administrator on that computer can connect to SQL Server as
a member of sysadmin fixed server role.-
Proposed as answer by
BalmukundMicrosoft employee
Monday, August 9, 2010 8:31 PM -
Marked as answer by
Ed Price — MSFTMicrosoft employee
Saturday, November 17, 2012 5:02 AM
-
Proposed as answer by
-
yeah. if you don’t have sa password and you have not added you as sysadmin then as Chirag metioned, single use mode is the option to add yourself as sysadmin to SQL
Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out
Start the instance of SQL Server in single-user mode by using either the
-m or
-f options. Any member of the computer’s local Administrators group can then connect to the instance of SQL Server as a member of the
sysadmin fixed server role.http://msdn.microsoft.com/en-us/library/dd207004.aspx
Balmukund Lakhani | Please mark solved if I’ve answered your question
———————————————————————————
This posting is provided «AS IS» with no warranties, and confers no rights.
———————————————————————————
My Blog: http://blogs.msdn.com/blakhani
Team Blog: http://blogs.msdn.com/sqlserverfaq-
Proposed as answer by
Naomi N
Sunday, February 27, 2011 10:11 PM -
Marked as answer by
Ed Price — MSFTMicrosoft employee
Saturday, November 17, 2012 5:02 AM
-
Proposed as answer by
Sql Server error 262 is common issue faced by SQ Server users when trying to create new database in SQL Server Management Studio. This error can appear also during login on SSMS. A message is returned that states that the account does not have “sysadmin” role to SQL Server.
Another reason si that starting with SQL 2008, local Administrators group is no longer added by default during SQL Server setup. You even have to use a manual step to add the current user as a local administrator. This means that it is possible, especially if you don’t use mixed authentication (or have forgotten the sa password), that you can be completely locked out of your own SQL Server instance.
For any reason you don’t have any account available on SQL Server with “sysadmin” role. So you can’t edit other users to add the specific database on their “user mapping”. The following article will tech how to fix those issue with privileges and permissions.
Error:
CREATE DATABASE permission denied in database ‘master’. (Microsoft SQL Server, Error: 262)
SQL Server error 262
SQL server error 262
Case 1 – You have a login available account with “sysadmin” role.
This case assumes that you have an account with sysadmin roles on SQL Server like an Admin. During the setup of SQL Server you must have specified (at least one) system administrator for the instance of SQL Server, or SA account if you are using mixed mode authentication. You need to use credentials for that account to gain access to your SQL Server.
After accessing the SQL Server Management Studio with this account you can create or edit other users (The user that having the error in his case) in order to have sysadmin role.
- Log on to the computer using the credentials for the Administrator account.
- Click the Start button, point to All Programs, click Microsoft SQL Server, and then click SQL Server Management Studio.
- Connect to the instance of SQL Server.
- Click Security, right-click Logins, and then click New Login.
- In the Login name box, enter the user name.
- In the Select a page , click Server Roles, select the sysadmin check box, and then click OK.
Case 2 – How to gain sysadmin access on SQL Server when you don’t have any user with “sysadmin” role.
The worst case is when you don’t have any sysadmin user to login on the system. The single option is to start SQL server in a single user mode, in that case anyone who is local administrator on that computer can connect to SQL Server as a member of sysadmin fixed server role.
Start the instance of SQL Server in single-user mode by using either the -m or -f options. Any member of the computer’s local Administrators group can then connect to the instance of SQL Server as a member of the sysadmin fixed server role.
Make sure you stop SQL agent service, before you put SQL server service in Single user mode else you can error saying only one user can be connected.
- Stop the SQL Server Service:
- Use SQL Server Configuration manager and stop the SQL service or use services to locate and stop SQL Service.
- Start SQL Server in Single User mode
- Use start-up parameter m to start SQL Service in single user mode.
- “net start MSSQLServer /m SQLCMD” if you want to use command line
- Using configuration Manager – Locate the service which you have stopped earlier. Go to its properties, “Advanced”, click on drop down at “Startup Parameters” and add ;-m
- Use start-up parameter m to start SQL Service in single user mode.
- Connect to SQL Server and add desired account in SysAdmin role.
- Open administrator command prompt. (i.e. right click on command prompt shortcut and choose “Run As Administrator”
- Type sqlcmd –S For example
- sqlcmd –S. (for default instance)
- sqlcmd –S.MyInstance
- You are connected as System Administrator, because you are part of local administrator group in windows.
- Use this script I normally use to add local administrator group as a part of SysAdmin group in SQL Server Instance.
USE [master]
GO
CREATE LOGIN [DomainUsername] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
EXEC master..sp_addsrvrolemember @loginame = N’ DomainUsername, @rolename = N’sysadmin’
GO
- Stop SQL Server Service.
- Remove startup parameter and Start SQL Service normally
This procedure is described on MSDN
Read also other SQL Server Helping Posts:
- Find Location of SQL Server Error Log
- SQL Server Error 300
- Restore Master Database
Case 3 – Adding specific permissions to the user
Grant SHOWPLAN access to the SQL user
SQL Server Error 262 can appear when user tries to check the execution plan using CTRL + M. A calculated execution plan is a SQL Server query plan that is created without actually running the query plan. Its main purpose is to check how query will behave without having to execute it. In order to include the execution plan in the query, we can allow user to grant SHOWPLAN access to the user. Fixing the error is possible by providing particular user the SHOWPLAN access using following commands:
USE DatabaseName
GO
GRANT SHOWPLAN TO UserName
GO
We can run the commands in the database where user faces the issue to make them view the query execution plan without any complications.
Let me know if you have any issue with the solutions regarding the Sql Server error 262.
- Remove From My Forums
-
Question
-
Hello Everyone,
I just bought a new computer, installed Windows 10 pro, sql server 2014 Express + SSMS 2016 Preview.
I have done this many times before and it always worked.
- I start SSMS «As Administrator» with Windows Authentication Mode.
- Then I try to create a new Database and I get an exception message.
CREATE DATABASE permission denied in database ‘master’. (Microsoft SQL Server, Error: 262)
SSMS 2014 Express did not work either.
I would any appreciate any help greatly! Kindest Blessings
Andreas Bolliger
Answers
-
Dear Andreas,
restart the sql server service in single user mode.
You have to add -m as a startup parameter in configuration manager and restart the service:
From this point you will be able to connect with any local windows administrator via sqlcmd as a sysadmin (only possible in single user mode for fixing those issues)
sqlcmd -S .<YourInstance>
Now create your missing login
CREATE LOGIN [<YourLogin>] FROM WINDOWS;
GO
Do not forget to add the created login to the sysadmin server role:
exec sp_addsrvrolemember [<YourLogin>], sysadmin; GO
Remove the -m startup parameter in SQL Server configuration manager, restart your instance and you will be able to be the real sysadmin.
PS: the correct way is realy to add an administrative login during setup. But afterwards this way will fix your problem without re-installing your sql server.
Best Regards
Kai
-
Proposed as answer by
Wednesday, May 11, 2016 8:33 PM
-
Edited by
Koppelmann, Kai
Wednesday, May 11, 2016 8:34 PM
Formatting -
Marked as answer by
BolligeA
Wednesday, May 11, 2016 8:40 PM
-
Proposed as answer by