{"id":677,"date":"2012-01-01T23:15:00","date_gmt":"2012-01-01T22:15:00","guid":{"rendered":"http:\/\/sburke.eu\/blog\/?p=677"},"modified":"2022-07-25T23:27:40","modified_gmt":"2022-07-25T22:27:40","slug":"allow-domain-admin-to-login-to-sqlserver-have-full-access","status":"publish","type":"post","link":"http:\/\/sburke.eu\/blog\/2012\/01\/allow-domain-admin-to-login-to-sqlserver-have-full-access\/","title":{"rendered":"Allow Domain Admin to Login to SQLServer &#038; have full Access"},"content":{"rendered":"\n<p>For some reason when SQLServer 2008 was installed\/setup, admins were not added. Therefore when trying to login via SQL Management Studio, an error was obtained:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Login failed for user \"username\". (Microsoft SQL Server, Error: 18456)<\/pre>\n\n\n\n<p>I also didn&#8217;t know the &#8220;sa&#8221; password which would have let me login. I also didn&#8217;t have access to another admin account to test logging in under their account.<\/p>\n\n\n\n<h3>Start SQLServer in single-user mode<\/h3>\n\n\n\n<ul><li>Open &#8220;SQL Server Configuration Manager&#8221; found in the Start Menu under Microsoft SQL Server 2008 R2 -&gt; Configuration Tools.<\/li><li>Right-Click properties of the SQL instance you want to start in single user mode.<\/li><li>(Optional \/ Maybe not required) Change the Logon Account to a different one<\/li><li>Under Advanced and &#8220;Startup Parameters&#8221;, add in:<br>;-m<\/li><li>Click Apply. Restart the Service<\/li><\/ul>\n\n\n\n<h3>Add Windows User as SQLServer Admin<\/h3>\n\n\n\n<ul><li>Start a Command Prompt (right-click Run as Administrator!!)<\/li><li>Issue the following commands:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">C:\\Windows\\system32&gt;<strong>sqlcmd -E<\/strong>\n1&gt; <strong>exec sp_addsrvrolemember 'yourdomain\\sburke', 'sysadmin';<\/strong>\n2&gt; <strong>go<\/strong>\n1&gt; <strong>exit<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">#For a named instance, go:\nsqlcmd -E -S servername\\instancename<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" width=\"1024\" height=\"730\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sqlserver-startup-in-single-user-mode-1024x730.gif\" alt=\"\" class=\"wp-image-679\" title=\"sqlserver-startup-in-single-user-mode\" srcset=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sqlserver-startup-in-single-user-mode-1024x730.gif 1024w, http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sqlserver-startup-in-single-user-mode-300x214.gif 300w, http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sqlserver-startup-in-single-user-mode-768x547.gif 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><a href=\"http:\/\/blogs.msdn.com\/b\/raulga\/archive\/2007\/07\/12\/disaster-recovery-what-to-do-when-the-sa-account-password-is-lost-in-sql-server-2005.aspx\" target=\"_blank\" rel=\"noreferrer noopener\">Reference&nbsp;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For some reason when SQLServer 2008 was installed\/setup, admins were not added. Therefore when trying to login via SQL Management Studio, an error was obtained: Login failed for user &#8220;username&#8221;. (Microsoft SQL Server, Error: 18456) I also didn&#8217;t know the &hellip; <a href=\"http:\/\/sburke.eu\/blog\/2012\/01\/allow-domain-admin-to-login-to-sqlserver-have-full-access\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[59],"_links":{"self":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/677"}],"collection":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/comments?post=677"}],"version-history":[{"count":2,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/677\/revisions"}],"predecessor-version":[{"id":680,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/677\/revisions\/680"}],"wp:attachment":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/media?parent=677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/categories?post=677"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/tags?post=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}