We have found very good article that helped us a lot so we are spreading it…
We got the CLOUD hosting that had SQL Server 2008 installed.
Unfortunately, we got this error:
CREATE DATABASE permission denied in database ‘master’
Despite being an administrator on the box, AND having launched Management Studio in Administrator mode (on Windows 2008R2).
Attempts to grant myself permissions, or to make any changes to SQL server resulted in:
User does not have permission to perform this action( Microsoft SQL Server, Error:15247)
This all happened because we were not the SQL Server administrators despite being an administrator on the machine itself. This is a new situation in SQL Server 2008. In SQL Server 2005, the local Administrators group was part of the SQL Server administrators. It turns out that only the person who installed SQL Server is a SQL Server administrator. Since that person was not available, we were faced with either uninstalling and reinstalling, or getting into an argument with SQL Server.
Being stubborn, we chose to argue. We knew as an Administrator that we could do anything we wanted, it was just a matter of finding the right registry keys/files/whatever to add ourself to the group. The trick is to put SQL server into single-user maintenance mode so that it ignores authentication.
NOTE: In all of the examples below, you may have to change parameters or command-lines based on your server name and instance name.
Force SQL server to support mixed-mode authentication
- Run REGEDIT
- Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer
NOTE: This key wiil vary slightly based on the installed version and instance name.
- Set “LoginMode” to 2. (Source: http://support.microsoft.com/kb/285097)
- Restart SQL Server.
Force SQL server to let you in temporarily
- Go to services.
- Stop SQL Server.
- Grab the SQL server command-line (right click the service – properties). Our is:
“c:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER2008\MSSQL\Binn\sqlservr.exe” -sMSSQLSERVER2008
- Open an administrative command prompt.
- Run the command-line from step 3, but add -m -c for single-user maintenance mode command-line so the final command looks like
“c:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER2008\MSSQL\Binn\sqlservr.exe” -sMSSQLSERVER2008 -m -c
- Open another administrative command prompt.
- Run “sqlcmd -S localhost\MSSQLSERVER2008″ from that same directory (replace with your server and instance name)
- Now you can do all the stuff everyone told you to do that didn”t work. For example, to create a hero user with administrative access:
CREATE LOGIN hero WITH PASSWORD=”123″, DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
EXEC sys.sp_addsrvrolemember @loginame = “hero”, @rolename = “sysadmin”
GO
- QUIT and close the command-prompt
- Go to the SQL Server command-line window and hit ctrl+C. It will prompt “Do you wish to shutdown SQL Server (Y/N)?” and enter Y.
- Close the command-prompt (Source: http://msdn.microsoft.com/en-us/library/dd207004.aspx)
Finally, login using your hero
- Restart the SQL Server service
- Login using SQL Server authentication as the user “hero” with password “123″
- And *BOOM* now you are in. Enjoy in your data!