SQL 在数据库“master”中创建表权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7313103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 11:59:46  来源:igfitidea点击:

create table permission denied in database 'master'

sqlsql-server-2008sql-server-express

提问by user1212

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

我已经在我的 PC 上安装了 sql server 2008(sql server management studio express edition)的免费版本。安装后我收到以下错误

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.

它显示我以访客身份登录。我该如何解决这个问题?因为我不允许创建新的登录名。

回答by TheCodeKing

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.

我读过错误可能是由 UAC 引起的(在旧版本的 SQL Server Express 上)。尝试右键单击 SQL Studio 并以管理员身份运行。

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

将当前用户添加到 SQL Server 'sysadmin' 角色的脚本

回答by Oleksii Iaroshchuk

You should use sp_addsrvrolememberto 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/

您应该使用sp_addsrvrolemember将您的用户添加到角色“系统管理员”中。这是帮助我解决这个问题的链接:http: //social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/76fc84f9-437c-4e71-ba3d-3c9ae794a7c4/

回答by user2908745

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.

即使我以主人身份登录,我也遇到了同样的问题。当我使用“select user_name();”时,我显示以“访客”身份登录。我在脚本之前使用了 'USE ,Database>' 子句确实有效。我希望这也适用于你们中的一些人。

回答by Gwen Au

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.

如果您的表实际上存在于不同的数据库(不是主数据库)中,您将需要切换到该数据库。用于更改数据库引用的 GUI 选项如下所示。

change_database_reference

change_database_reference

回答by Rajesh Raj

  1. select USER_NAME() execute this query,if you find the username as guest then just close the sql server..
  1. 选择 USER_NAME() 执行此查询,如果您发现用户名是来宾,则只需关闭 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

2.然后去开始菜单右键单击sql server图标并选择选项“以管理员身份运行”..现在您可以创建数据库

回答by Ankur Bhutani

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/

如果您在 Sql server 2008 management studio 中遇到相同的错误,那么下面的链接将解决这个错误,我找到了这个并通过 blipsalt http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/检查答案 线程/76fc84f9-437c-4e71-ba3d-3c9ae794a7c4/

回答by Haseeb Jadoon

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

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.

我的 Sql Server 的问题是我可以使用 USER-NAME 帐户登录,但不能使用 USER-NAME\SQLEXPRESS 帐户登录。USER-NAME 服务器只有访客权限,而 USER-NAME\SQLEXPRESS 具有完整权限。您可以通过执行此查询来检查。

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.

我继续检查我的服务是否正在运行。您可以通过单击开始并输入“services.msc”来实现。打开它并搜索“SQL Server (SQLEXPRESS)”。如果尚未启动,请启动它。

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.

完成所有这些后,我再次启动了 Sql Server Management Studio 并使用 USER-NAME\SQLEXPRESS 进行连接,并且它工作正常。

Cheers,

干杯,