Get your Microsoft SQL Server LocalDB Instance up and running

Previous post How to get your developer workstation Microsoft SQL Server Express LocalDB-ready

In our last blog post we learned how we:

  • install a Microsoft SQL Server LocalDB using Visual Studio Installer
  • Install Chocolatey
  • use Chocolatey to install the Microsoft SQL Server Management Studio (SSMS)

Now we need to configure LocalDB in order to use it. To configure LocalDB, we can use a tool called SqlLocalDb.exe. i’ll quickly search for that tool, then execute it with the info paramter

gci SqlLocalDb.exe -Recurse -ErrorAction SilentlyContinue
Search for SqlLocalDb.exe / get LocalDB Info

If you already have a MSSQLLocalDB instance running (MSSQLLocalDB in my case) , you’re ready to go.

You can get more information about the running MSSQLLocalDB (like the path where the .mdf and .ldf files reside or also the error.log) using the following PowerShell command:

gwmi win32_process -Filter "name = 'sqlservr.exe'" | select CommandLine | fl

If not do not already have an instance running, you can create and start one using the following commands:

.\SqlLocalDB.exe Create myLocalDB
.\SqlLocalDB.exe start myLocalDB

Now you can connect to the LocalDB instance using SQL Server Management Studio (SSMS) like follows: