一点星光 發表於 2019-9-8 00:45:00

在 Debian 上的 SQL Server 的安裝指引

<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">我想在 linux 环境下尝试一下 Microsoft SQL Server,但是微软只发布了针对 Red Hat,SUSE,Ubuntu 和 Docker 引擎的。我平时习惯使用 Debian, Ubuntu 是基于 Debian 的,所以就基本按照在 Ubuntu 上安装的方法在 Debian 上安装,最终成功安装了。</p>
<h2 id="toc-heading-1" style="margin: 42px 0 18px -5px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.8rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.8rem; font-style: normal; font-weight: bold; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">系统要求</h2>
<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">SQL Server 2017 具有以下适用于 Linux 的系统要求:</p>
<table style="padding: 12px 13px; border: 1px solid rgba(223, 226, 229, 1); width: 792px; color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; display: table; white-space: normal; border-collapse: collapse; box-sizing: inherit; border-spacing: 0; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">
<thead>
<tr><th>内存</th><th>2 GB</th></tr>
</thead>
<tbody>
<tr>
<td>文件系统</td>
<td>XFS或EXT4 (其他文件系统,如BTRFS,均不受支持)</td>
</tr>
<tr>
<td>磁盘空间</td>
<td>6 GB</td>
</tr>
<tr>
<td>处理器速度</td>
<td>2 GHz</td>
</tr>
<tr>
<td>处理器核心</td>
<td>2个核心</td>
</tr>
<tr>
<td>处理器核心</td>
<td>仅 x64 兼容</td>
</tr>
</tbody>
</table>
<h2 id="toc-heading-2" style="margin: 42px 0 18px -5px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.8rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.8rem; font-style: normal; font-weight: bold; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">安装 SQL Server</h2>
<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">若要在 Ubuntu 上配置 SQL Server ,在终端中运行以下命令安装mssql server包。</p>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">
<li>导入公共存储库 GPG 密钥:</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token function">wget -qO- https://packages.microsoft.com/keys/microsoft.asc <span class="token operator">| <span class="token function">sudo apt-key add -
</span></span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="2">
<li>注册 Microsoft SQL Server Ubuntu 存储库:</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none">curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list <span class="token operator">| <span class="token function">sudo <span class="token function">tee /etc/apt/sources.list.d/mssql-server.list
</span></span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="3">
<li>运行以下命令,安装 SQL Server:</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token function">sudo <span class="token function">apt-get update
<span class="token function">sudo <span class="token function">apt-get <span class="token function">install -y mssql-server
</span></span></span></span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="4">
<li>程序包安装完成后,请运行 mssql-conf setup 命令并按提示设置 SA 密码,然后选择版本。</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token function">sudo /opt/mssql/bin/mssql-conf setup
</span></code></pre>
<blockquote style="margin: 20px 0; padding: 1rem 0.8rem 0.2rem; color: rgba(102, 102, 102, 1); text-transform: none; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0; border-left: 5px solid rgba(66, 185, 131, 1); white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(66, 185, 131, 0.1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">
<p>备注<br>请确保为 SA 帐户指定强密码(最少 8 个字符,包括大写和小写字母、十进制数字和/或非字母数字符号)。</p>

</blockquote>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="5">
<li>配置完成后,请验证服务是否正在运行:</li>

</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none">systemctl status mssql-server
</code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="6">
<li>如果你打算远程连接,你可能还需要打开防火墙上的 SQL Server TCP 端口 (默认值为 1433)。</li>
</ol>
<ul style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; list-style-type: none; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">
<li>安装 firewalld 工具包并设置防火墙开启 SQL Server 服务端口:</li>
</ul>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token function">sudo apt <span class="token function">install firewalld
firewall-cmd --zone<span class="token operator">=public --add-port<span class="token operator">=1433/tcp --permanent
firewall-cmd --reload
</span></span></span></span></code></pre>
<h2 id="toc-heading-3" style="margin: 42px 0 18px -5px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.8rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.8rem; font-style: normal; font-weight: bold; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">安装 SQL Server 命令行工具</h2>
<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">若要创建数据库,需要使用一个能够在 SQL Server 上运行 Transact-SQL 语句的工具进行连接。 以下步骤安装 SQL Server 命令行工具: sqlcmd和bcp。</p>
<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">使用以下步骤来安装 mssql-tools。</p>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">
<li>导入公共存储库 GPG 密钥。</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none">curl https://packages.microsoft.com/keys/microsoft.asc <span class="token operator">| <span class="token function">sudo apt-key add -
</span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="2">
<li>注册 Microsoft Ubuntu 存储库。</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none">curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list <span class="token operator">| <span class="token function">sudo <span class="token function">tee /etc/apt/sources.list.d/msprod.list
</span></span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="3">
<li>更新源列表,并安装SQL Server工具包。</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token function">sudo <span class="token function">apt-get update
<span class="token function">sudo <span class="token function">apt-get <span class="token function">install mssql-tools unixodbc-dev
</span></span></span></span></span></code></pre>
<ol style="color: rgba(52, 73, 94, 1); text-transform: none; text-indent: 0; letter-spacing: normal; padding-left: 2em !important; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 15px; font-style: normal; font-weight: 400; word-spacing: 0.05rem; display: block; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial" start="4">
<li>Sqlcmd 工具默认安装到&nbsp;<code style="padding: 1px 5px; border-radius: 2px; color: rgba(233, 105, 0, 1); font-family: Inconsolata, Monaco, Consolas, &quot;Courier New&quot;, Courier, monospace; font-size: 0.91rem; box-sizing: inherit; background-color: rgba(248, 248, 248, 1)">/opt/mssql-tools/bin/</code>&nbsp;中的,为方便使用把&nbsp;<code style="padding: 1px 5px; border-radius: 2px; color: rgba(233, 105, 0, 1); font-family: Inconsolata, Monaco, Consolas, &quot;Courier New&quot;, Courier, monospace; font-size: 0.91rem; box-sizing: inherit; background-color: rgba(248, 248, 248, 1)">/opt/mssql-tools/bin/</code>&nbsp;添加到环境变量中。</li>
</ol>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none"><span class="token keyword">echo <span class="token string">'export PATH="<span class="token variable">$PATH:/opt/mssql-tools/bin"' <span class="token operator">&gt;&gt; ~/.bash_profile
<span class="token keyword">echo <span class="token string">'export PATH="<span class="token variable">$PATH:/opt/mssql-tools/bin"' <span class="token operator">&gt;&gt; ~/.bashrc
<span class="token function">source ~/.bashrc
</span></span></span></span></span></span></span></span></span></code></pre>
<h2 id="toc-heading-4" style="margin: 42px 0 18px -5px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.8rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.8rem; font-style: normal; font-weight: bold; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">本地连接</h2>
<p style="margin: 2px 2px 10px; color: rgba(52, 73, 94, 1); text-transform: none; line-height: 1.85rem; text-indent: 0; letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Roboto, Oxygen-Sans, Ubuntu, Cantarell, &quot;Helvetica Neue&quot;, sans-serif; font-size: 1.05rem; font-style: normal; font-weight: 400; word-spacing: 0; white-space: normal; box-sizing: inherit; orphans: 2; widows: 2; background-color: rgba(255, 255, 255, 1); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial">以下步骤使用 sqlcmd 本地连接到新的 SQL Server 实例。<br>使用 SQL Server 名称 (-S),用户名 (-U) 的参数运行 sqlcmd。 在本教程中,用户进行本地连接,因此服务器名称为 localhost。 用户名为 SA 。</p>
<pre class="line-numbers language-bash"><code class="language-bash" style="padding: 0 1em 0 3.8em; border-radius: 2px; height: inherit; text-align: left; color: rgba(0, 0, 0, 1); line-height: 1.5; overflow: auto; font-family: Consolas, Monaco, &quot;Andale Mono&quot;, &quot;Ubuntu Mono&quot;, monospace; font-size: 1em; word-spacing: normal; border-left: 10px solid rgba(53, 140, 203, 1); display: block; white-space: inherit; position: relative; -ms-word-break: normal; -ms-word-wrap: normal; max-height: inherit; box-sizing: inherit; box-shadow: -1px 0 rgba(53, 140, 203, 1), 0 0 1px rgba(223, 223, 223, 1); tab-size: 4; hyphens: none">sqlcmd -S localhost -U SA -P <span class="token string">'&lt;YourPassword&gt;'</span></code></pre><br><br>
来源:https://www.cnblogs.com/surplus/p/11484089.html
頁: [1]
查看完整版本: 在 Debian 上的 SQL Server 的安裝指引