localdb 安装_如何安装Microsoft SQL Server Express LocalDB

localdb 安装

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是主要面向开发人员的解决方案,是SQL Server Express的轻量级版本。 这是非常容易安装和设置的。 安装过程将复制启动SQL Server数据库引擎所需的最少文件集。 LocalDB支持与SQL Server Express相同的T-SQL语言,并具有相同的限制

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.

Microsoft SQL Server Express LocalDB允许开发人员编写和测试Transact-SQL代码。 但是,无需管理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.

有两种安装LocalDB的方法其中一种是使用SqlLocalDB.msi程序。 第二种方法是在安装SQL Server Express 2012或更高版本时的一个选项。

Extension of database file of SQL Server Express LocalDB is the same as SQL Server Express and it is (.mdf).

SQL Server Express LocalDB的数据库文件扩展名与SQL Server Express相同,并且扩展名为(.mdf)。

使用SqlLocaLDB.MSI安装Microsoft SQL Server 2012 Express LocalDB (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).

安装LocalDB有一些要求。 用户应具有Microsoft .NET Framework 4Microsoft .NET Framework 4.0.2运行时更新(KB2544514) 。 取决于操作系统(32位或64位Windows版本),有SqlLocaLDB.MSI的两个版本:可以安装在32位操作系统上的版本( x86 / SqlLocalDB.MSI )和可以安装在32位操作系统上的版本。可以安装在64位操作系统( x64 / SqlLocalDB.MSI )上。

The SqlLocaDB.MSI can be downloaded as a separate item from the SQL Server download page:

可以从SQL Server下载页面将SqlLocaDB.MSI作为单独的项目下载

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

If to the 32-bit version of Microsoft SQL Server Express LocalDB is installed on 64-bit Windows, the following warning message will appear:

如果在64位Windows上安装了32位版本的Microsoft SQL Server Express LocalDB ,则会出现以下警告消息:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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:

SqlLocalDB.MSI的安装过程非常快捷。 当用户双击SqlLocaDB.MSI安装文件时,将出现Microsoft SQL Server 2012 Express LocalDB窗口。 然后应单击“下一步”按钮以继续:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

On the License Agreement window, read the license terms of use carefully and check the “I accept the terms in the license agreement” radio button. And again, click the Next button:

在“许可协议”窗口中,仔细阅读许可使用条款,并选中“我接受许可协议中的条款”单选按钮。 再次,单击下一步按钮:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

The following step is to click the Installation button:

下一步是单击“安装”按钮:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

After a few seconds, the installation process will be finished:

几秒钟后,安装过程将完成:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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.

Microsoft SQL Server 2014 Express LocalDBMicrosoft SQL Server 2016 Express LocalDB的安装过程相同。 仅Microsoft SQL Server 2016 Express LocalDB的下载过程有所不同。 本文稍后会详细介绍有关下载/安装Microsoft SQL Server 2016 Express LocalDB的说明。

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”:

默认情况下,带有所有必需DLL的Microsoft SQL Server 2012 Express LocalDB位于“ [驱动器号:] \ Program Files \ Microsoft SQL Server \ 110 \ LocalDB \ Binn”处:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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.

一旦安装了程序,就可以启动默认的(自动)LocalDB实例,或者使用SqlLocalDb实用程序创建并使用他自己的LocalDB实例。

To see all LocalDB instances, in the Command Prompt window, type following command: SqlLocalDB info.

若要查看所有LocalDB实例,请在“命令提示符”窗口中,键入以下命令: SqlLocalDB info

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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.

默认的(自动)LocalDB实例名称以单个字符v开头在此字符之后,数字的格式为xx.x ,表示LocalDB版本号。 例如, v11.0代表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:

在使用自动LocalDB实例之前,需要先创建自动LocalDB实例。 另一方面,将出现以下消息:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

In order to create an automatic LocaDB instance, in the Command Prompt window, the following command: SqlLocalDB create v11.0 should be typed.

为了创建自动LocaDB实例,请在“命令提示符”窗口中键入以下命令: SqlLocalDB create v11.0

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

The default (automatic) LocalDB instance is public while user named instances of LocalDB are private.

默认的(自动)LocalDB实例为public,而用户命名的LocalDB实例为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.

LocalDB支持实例共享,这意味着一个用户(一个实例的所有者)可以允许其他用户连接到他的实例。 共享/不共享的方式 可以通过使用SqlLocalDB Utility 共享/未共享 命令来实现LocalDB实例

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.

SQL Server Express LocalDB实例设置为SQL_Latin1_General_CP1_CI_AS 排序规则,不能更改。 通常支持数据库,列和表达式级别的集合。

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

默认情况下,数据库的系统数据库文件存储在以下位置:C:\ Users \ <用户名> \ AppData \ Local \ Microsoft \ Microsoft SQL Server本地DB \ Instances

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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).

如上所述, Microsoft SQL Server 2014 Express LocalDB的安装过程与Microsoft SQL Server 2012 Express LocalDB的安装过程相同。 现在,名称“ MSSQLLocalDB ”用作自动LocalDB实例的默认名称。 自动LocalDB实例的名称不再与SQL Server版本号相关,就像在SQL Server 2012版本中一样( 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:

现在,在安装了 Microsoft SQL Server 2014 Express LocalDB之后 或更新的版本,并且在“命令提示符”窗口中运行SqlLocalDB info命令,将出现以下结果:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

SQL Server 2016 Express LocalDB is available through the installation process of SQL Server 2016 Express and when the option Download Media is chosen:

SQL Server 2016快速的LocalDB可通过安装过程SQL Server 2016点快速而当选择下载选择媒体:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

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:

如果选择了下载媒体,则有两种下载和安装SQL Server 2016 Express LocalDB的方法 。 第一个是选择LocalDB单选按钮。 另一种是通过使用Express Advanced

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

静默安装Microsoft SQL Server Express LocalDB (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:

Microsoft SQL Server Express LocalDB支持静默安装。 用户应下载SqlLocalDB.msi并以管理员身份运行“命令提示符”窗口。 然后,他们应该粘贴以下命令:

msiexec /i SqlLocalDB.msi /qn IACCEPTSQLLOCALDBLICENSETERMS=YES

msiexec / i SqlLocalDB.msi / qn IACCEPTSQLLOCALDBLICENSETERMS = YES

The next step is pressing the Enter key from the keyboard:

下一步是按键盘上的Enter键:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

A user should make sure that the path in which SqlLocalDB.msi is located is correct, otherwise the following error may appear:

用户应确保SqlLocalDB.msi所在的路径正确,否则可能会出现以下错误:

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

Installation Microsoft SQL Server Express LocalDB as an option during the installation of SQL Server Express version

在安装SQL Server Express版本期间,可以选择安装Microsoft SQL Server Express LocalDB

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.

如本文前面所述,当安装Express版本的SQL Server 2012或更新的版本时,可以选择一种安装LocalDB的方法。

LocalDB should be selected from the Feature Selection page during the installation of the SQL Server Express version:

在安装SQL Server Express版本期间,应从“功能选择”页中选择LocalDB

localdb 安装_如何安装Microsoft SQL Server Express LocalDB

Next article in this series

本系列的下一篇文章

有用的链接 (Useful links)

翻译自: https://www.sqlshack.com/install-microsoft-sql-server-express-localdb/

localdb 安装