Tag Archives: SQL Server

SQL Server 2008: Create administrator account without admin login

Deploying our development machines from virtual machine templates saves us a lot of time, however every now and then we hit frustrating little speed bumps. Here is the latest – SQL Server 2008 / SQL Server 2008 Express not having an administrator account enabled.

To fix this problem you must first stop the SQL Server 2008 instance, and start it in “single user mode” (you need to be local administrator for this to work).

  1. Stop the SQL Server instance in Service Manager
  2. Open cmd prompt
  3. browse to appropriate SQL Server installation: e.g. cd\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Binn
  4. Start SQL Server in single user mode using the “-m” switch:
    For a default instance: sqlservr.exe -m
    For SQLEXPRESS/named instance: sqlservr.exe -m -sSQLEXPRESS
  5. You can now connect to the SQL Server instance via SQL Server Management Console and create your administrative user, or use SQLCMD from the command prompt e.g.:
    2> go
    1> exec sp_addsrvrolemember @loginame='YOURDOMAIN\justin', @rolename='sysadmin'
    2> go
  6. Stop the server (Ctrl+C)
  7. Start the service again from Service Manager

SQL Server 2005: Error: 18452 Login failed for user ‘username’. The user is not associated with a trusted SQL Server connection.

Fatal error: Uncaught Error: Call to a member function id() on array in /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php:36 Stack trace: #0 /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(538): CrayonFormatter::format_code('', Array, Object(CrayonHighlighter)) #1 [internal function]: CrayonFormatter::delim_to_internal(Array) #2 /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php(516): preg_replace_callback('#()#msi', 'CrayonFormatter...', '<span style="co...') #3 /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(166): CrayonFormatter::format_mixed_code('<span style="co...', Object(CrayonLang), Object(CrayonHighlighter)) #4 /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_highlighter.class.php(186): CrayonHighlighter->process() #5 /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highligh in /home/derp4640/public_html/wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php on line 36