Home   Notes   Contact Me

SQL Server

Local

External


MD5 Hash

# Note that the has function returns bytes: HASHBYTES('MD5', 'saltedPasswordToHash') # If you need text then do this (I think 'master.dbo.fn_varbintohexstr' is undocumented) SUBSTRING(master.dbo.fn_varbintohexstr(HASHBYTES('MD5', 'saltedPasswordToHash')), 3, 32)

Remote Access via Command Line

  1. Use Microsoft SQL Server Management Studio | Security | Logins to add a new user with SQL Server authentication.
  2. Use Sql Server Configuration Manager | SQL Server Network Configuration | Protocols for MSSQLSERVER to enable TCP/IP.
  3. Use Microsoft SQL Server Management Studio to restart the server.
  4. Connect from a remote machine using sqlcmd:
    sqlcmd -S {ipaddress} -U {username} -P {password} sqlcmd -S 10.20.30.40 -U root -P password

Show Databases

USE DatabaseName GO

Show Databases

EXEC sp_databases GO

Command line interface

sqlcmd :help