Microsoft SQL Server Express LocalDB, a solution primarily intended for developers, is a lightweight version of SQL Server Express. It is very easy to install and set up. The installation copies a minimum set of files which are necessary to start SQL Server Database Engine. LocalDB supports the same T-SQL language and has the same limitations as SQL Server Express.
Microsoft SQL Server Express LocalDB allows developers to write and test Transact-SQL code. But, without having to manage a full server instance of SQL Server.
There are two methods of installing LocalDB, one of them is using the SqlLocalDB.msi program. The second method is an option when SQL Server Express 2012 or a newer version is being installed.
Extension of database file of SQL Server Express LocalDB is the same as SQL Server Express and it is (.mdf).
Installing Microsoft SQL Server 2012 Express LocalDB with the SqlLocaLDB.MSI
There are some requirements for installing LocalDB. A user should have Microsoft .NET Framework 4 and Microsoft .NET Framework 4.0.2 Runtime Update (KB2544514). Depending on the operating system (32-bit or 64-bit Windows version), there are two versions of SqlLocaLDB.MSI: the version that can be installed on 32-bit operating system (x86/SqlLocalDB.MSI) and the version which can be installed on 64-bit operating system (x64/SqlLocalDB.MSI).
The SqlLocaDB.MSI can be downloaded as a separate item from the SQL Server download page:
If to the 32-bit version of Microsoft SQL Server Express LocalDB is installed on 64-bit Windows, the following warning message will appear:
The Installation process of SqlLocalDB.MSI is very quick and easy. When a user double clicks on the SqlLocaDB.MSI installation file, the Microsoft SQL Server 2012 Express LocalDB window will appear; then the Next button should be clicked in order to continue:
The following step is to click the Installation button:
After a few seconds, the installation process will be finished:
The installation process is the same both for the Microsoft SQL Server 2014 Express LocalDB and Microsoft SQL Server 2016 Express LocalDB. Only the downloading process for Microsoft SQL Server 2016 Express LocalDB is a bit different. The explanation about downloading/ installing Microsoft SQL Server 2016 Express LocalDB is covered in more detail later in this article.
By default, the Microsoft SQL Server 2012 Express LocalDB with all necessary DLLs is located at “[drive letter:]\Program Files\Microsoft SQL Server\110\LocalDB\Binn”:
Once the program is installed, the default (automatic) LocalDB instance can be started or creating and using his own LocalDB instance by using the SqlLocalDb utility.
To see all LocalDB instances, in the Command Prompt window, type following command: SqlLocalDB info.
The default (automatic) LocalDB instance name begins with a single character v. After this character, the number is in this format xx.x which presents a LocalDB version number. For example, v11.0 represents SQL Server 2012.
Before using the automatic LocalDB instance, the automatic LocalDB instance needs to be created first. On the other hand, the following message will appear:
In order to create an automatic LocaDB instance, in the Command Prompt window, the following command: SqlLocalDB create v11.0 should be typed.
The default (automatic) LocalDB instance is public while user named instances of LocalDB are private.
LocalDB supports instance sharing, which means that a user, the owner of an instance, can allow other users to connect to his instance. The way of sharing / unsharring LocalDB instance can be achieved by using SqlLocalDB Utility share/unshared commands.
Different users of the computer can create the instances with the same name.
The SQL Server Express LocalDB instance is set to SQL_Latin1_General_CP1_CI_AS collation and cannot be changed. The database, column and expression level collections are supported normally.
The system database files for the database are, by default, stored under this location: C:\Users\<User_Name>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances
As it is mentioned above, the installation process of Microsoft SQL Server 2014 Express LocalDB is the same as the installation process of Microsoft SQL Server 2012 Express LocalDB. The name “MSSQLLocalDB” is, now, used as a default name for the automatic LocalDB instance. The name of the automatic LocalDB instance is no longer related to the SQL Server version number as it was in the SQL Server 2012 version (v11. 0=SQL Server 2012).
Now, after Microsoft SQL Server 2014 Express LocalDB has been installed or a newer one and the SqlLocalDB info command is run in the Command Prompt window, the following result will appear:
If Download Media has been chosen, there are two ways to download and install SQL Server 2016 Express LocalDB. The first one is to select the LocalDB radio button. The other one is by using Express Advanced:
Silent installation of Microsoft SQL Server Express LocalDB
Microsoft SQL Server Express LocalDB supports silent installation. A user should download SqlLocalDB.msi and run the Command Prompt window as an administrator. Then, they should paste the following command:
msiexec /i SqlLocalDB.msi /qn IACCEPTSQLLOCALDBLICENSETERMS=YES
The next step is pressing the Enter key from the keyboard:
A user should make sure that the path in which SqlLocalDB.msi is located is correct, otherwise the following error may appear:
Installation Microsoft SQL Server Express LocalDB as an option during the installation of SQL Server Express version
As it was mentioned earlier in this article, one way of installing LocalDB is the option when the Express version of SQL Server 2012 or a newer one is installed.
LocalDB should be selected from the Feature Selection page during the installation of the SQL Server Express version:
Next article in this series
- Introducing LocalDB, an improved SQL Express
- SQL Server 2016 Express LocalDB
- .NET Framework 4 now supports LocalDB!
- SQL Server Express LocalDB Instance API Reference
- How to Connect to a Remote MySQL Server Using SSH - October 18, 2019
- How to create and configure a linked server to connect to MySQL in SQL Server Management Studio - October 7, 2019
- Manage SQL code formatting using SQL formatter options - October 24, 2018
Currently working for ApexSQL LLC as a Software Sales Engineer, he is helping customers with any technical issues and does quality assurance for ApexSQL Complete, ApexSQL Refactor and ApexSQL Search free add-ins.
View all posts by Marko Zivkovic