create table permission denied in database 'master'

邮差的信 提交于 2019-12-18 02:43:11

问题


I have installed the free version of sql server 2008 (sql server management studio express edition) on my PC. After installation I get the following error

create table permission denied in database 'master'

I tried reinstalling several times, but I keep getting the same error. When i checked

select user_account();

It showed that I was logged in as guest. How do I solve this? since I am not permitted to create a new login.


回答1:


I've read the error can be caused by UAC (on older versions of SQL Server Express). Try right-clicking on SQL Studio and running as administrator.

If that doesn't work there's supposedly a fix here for the same issue. Probably worth a try.

Script to add the current user to the SQL Server 'sysadmin' role




回答2:


You should use sp_addsrvrolemember to add your user into role 'sysadmin'. Here is link that helped me to solve this problem: http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/76fc84f9-437c-4e71-ba3d-3c9ae794a7c4/




回答3:


I had the sam eproblem even though I was logged in as master. I was showing logged in as "guest", when I used 'select user_name();'. I used 'USE ,Database>' clause before script an dit really worked. I hope this works for some of you too.




回答4:


  1. select USER_NAME() execute this query,if you find the username as guest then just close the sql server..

2.Then go to start menu right click the sql server icon and choose the option "Run as administrator"..Now you can create the database




回答5:


If your table actually exists in a different database (not master), you will need to switch to that database. A GUI option to change the database reference is shown below.




回答6:


If you got the same error in Sql server 2008 management studio than below link will resolve this error after so much i found this and check answer by blipsalt http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/76fc84f9-437c-4e71-ba3d-3c9ae794a7c4/




回答7:


I was also facing the same problem. After putting in a great effort I came across this beautiful link

http://www.metatexis.net/manual_server/errorwhenusingmssqlservernamedpipesprovidercouldnotopenaconnectiontosqlserver.htm

The problem with my Sql Server was that I could login using USER-NAME account but not USER-NAME\SQLEXPRESS account. USER-NAME server had just Guest permissions whereas USER-NAME\SQLEXPRESS has complete permissions. You can check that by executing this query.

select user_name()

I went on to check whether my service is running or not. You can do that by clicking start and typing in "services.msc". Open that and search for "SQL Server (SQLEXPRESS)". Start it if its not already started.

In my case it was disabled. I right clicked it. Went to properties and changed "Startup type" to "Automatic".

After doing all this I started Sql Server Management Studio again and connected using USER-NAME\SQLEXPRESS and it worked.

Cheers,



来源:https://stackoverflow.com/questions/7313103/create-table-permission-denied-in-database-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!