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:
Open a command prompt as administrator
List the LocalDB instances using the command:
sqllocaldb i
By default, LocalDB is created by Jiwa with an instance called "MSSQLLocalDB". Stop the selected instance:
sqllocaldb p MSSQLLocalDB
Delete the selected instance:
sqllocaldb d MSSQLLocalDB
Recreate the selected instance:
sqllocaldb c MSSQLLocalDB
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.