Create a clean LocalDB Installation



Sometimes you may need to clean out your LocalDB installation. For example, perhaps you need to delete all databases and create new ones. When you do not have access to SQL Server tools such as Microsoft SQL Server Management Studio,there is a command line tool that can be used instead.



Warning!

This procedure will delete all databases that are part of a LocalDB installation.

Step-by-step guide

If you are experiencing problems connecting to your LocalDB installation, creating a demo database on your LocalDB installation, or if you just wish to start fresh, follow the guide below:



  1. Open a command prompt as administrator


  2. List the LocalDB instances using the command:

    sqllocaldb i



  3. By default, LocalDB is created by Jiwa with an instance called "MSSQLLocalDB". Stop the selected instance:

    sqllocaldb p MSSQLLocalDB



  4. Delete the selected instance:

    sqllocaldb d MSSQLLocalDB



  5. Recreate the selected instance:

    sqllocaldb c MSSQLLocalDB



  6. Start the newly created instance:

    sqllocaldb s MSSQLLocalDB



 You should now be able to use the Jiwa Database Manager to create a new demonstration database on LocalDB. See here for more information.



Tip

The system database files for the database are stored in the users' local AppData path which is normally hidden. For example C:\Users\--user--\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB. Sometimes it is necessary to go to this folder using Windows Explorer and delete .mdf and .ldf files for databases you no longer want.